From 46bf79d480d9ab718dd23fdb6ad185fe9652964e Mon Sep 17 00:00:00 2001 From: ALW <850658129@qq.com> Date: Tue, 22 Mar 2022 08:41:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=9B=E5=B1=B1=E4=B8=89=E9=99=A2360?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 24 + .../com/emr/controller/FontController.java | 533 +++++++++++++----- .../controller/JAXDynamicClientFactory.java | 7 + .../com/emr/controller/LoginController.java | 4 +- src/main/java/com/emr/util/DateUtil.java | 2 +- src/main/java/com/emr/vo/EsbPublicVo.java | 62 ++ src/main/java/com/emr/vo/SecureloginVo.java | 79 +++ .../webapp/static/js/record/recordPage.js | 23 +- 8 files changed, 582 insertions(+), 152 deletions(-) create mode 100644 src/main/java/com/emr/vo/EsbPublicVo.java create mode 100644 src/main/java/com/emr/vo/SecureloginVo.java diff --git a/pom.xml b/pom.xml index 3f8e780..b7b3ee7 100644 --- a/pom.xml +++ b/pom.xml @@ -126,6 +126,18 @@ ${aspectj.version} + + + org.apache.cxf + cxf-rt-transports-http + 3.1.8 + + + org.apache.cxf + cxf-rt-frontend-jaxws + 3.1.8 + + jstl jstl @@ -231,6 +243,18 @@ ${lombok.version} provided + + jdom + jdom + 1.0 + + + + dom4j + dom4j + 1.6.1 + + diff --git a/src/main/java/com/emr/controller/FontController.java b/src/main/java/com/emr/controller/FontController.java index 221823d..ae6888c 100644 --- a/src/main/java/com/emr/controller/FontController.java +++ b/src/main/java/com/emr/controller/FontController.java @@ -1,6 +1,7 @@ package com.emr.controller; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; import com.emr.dao.Emr_DictionaryMapper; import com.emr.dao.TPrintinfoMapper; import com.emr.entity.*; @@ -12,13 +13,30 @@ import com.emr.util.ExceptionPrintUtil; import com.emr.util.Msg; import com.emr.vo.ArchiveFlowInfoVo; import com.emr.vo.ArchiveOtherExtVo; +import com.emr.vo.EsbPublicVo; +import com.emr.vo.SecureloginVo; import net.sf.json.JSONObject; import org.apache.commons.lang3.StringUtils; +import org.apache.cxf.endpoint.Client; +import org.apache.http.HttpEntity; +import org.apache.http.client.ClientProtocolException; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; import org.apache.shiro.util.CollectionUtils; +import org.dom4j.Document; +import org.dom4j.DocumentHelper; +import java.text.ParseException; +import java.util.ArrayList; +import java.util.List; + +import org.dom4j.Element; +import org.dom4j.io.SAXReader; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; @@ -31,7 +49,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import java.io.IOException; -import java.text.ParseException; +import java.io.StringReader; import java.text.SimpleDateFormat; import java.util.*; @@ -43,6 +61,10 @@ import java.util.*; public class FontController { @Value("${pdfWater}") private String pdfWater; + @Value("${RoomDetailsUrl}") + private String RoomDetailsUrl; + @Value("${RoomDetailsUrlName}") + private String RoomDetailsUrlName; @Value("${allAddortIds}") private String allAddortIds; @Value("${POWER_URLHEAD}") @@ -68,8 +90,8 @@ public class FontController { @RequestMapping("selectIsPrintByPatienId") @ResponseBody - public Msg selectIsPrintByPatienId(String patientId) throws Exception{ - if(StringUtils.isBlank(patientId)){ + public Msg selectIsPrintByPatienId(String patientId) throws Exception { + if (StringUtils.isBlank(patientId)) { return Msg.fail("参数patientId不能为空"); } return printinfoService.selectIsPrintByPatienId(patientId); @@ -77,20 +99,20 @@ public class FontController { /***************************提供第三方按多个分段id和记账号查询病历pdf***********************************/ /** * 提供第三方按多个分段id和记账号查询病历pdf - * */ + */ @RequestMapping("showRecordByPatientId") - public String showRecordByPatientId(String userName, String assortIds, String patientId, Model model){ + public String showRecordByPatientId(String userName, String assortIds, String patientId, Model model) { /* //判断各参数 if(StringUtils.isBlank(userName)){ return retrunErrorPage(model,"工号不能为空!"); }*/ - if(StringUtils.isBlank(assortIds)){ - return retrunErrorPage(model,"病案分类Id不能为空!"); + if (StringUtils.isBlank(assortIds)) { + return retrunErrorPage(model, "病案分类Id不能为空!"); } - if(StringUtils.isBlank(patientId)){ - return retrunErrorPage(model,"记账号不能为空!"); + if (StringUtils.isBlank(patientId)) { + return retrunErrorPage(model, "记账号不能为空!"); } - List list = new ArrayList<>(); + List list = new ArrayList<>(); //判断工号是否存在 try { /* String checkUserName = checkUserName(userName); @@ -98,7 +120,7 @@ public class FontController { return retrunErrorPage(model,checkUserName); }*/ //判断分类id是否存在,协商assortIds = "00000000"为查询全部 - if(!allAddortIds.equals(assortIds)) { + if (!allAddortIds.equals(assortIds)) { String checkAssortIds = checkAssortIds(assortIds); if (StringUtils.isNotBlank(checkAssortIds)) { return retrunErrorPage(model, checkAssortIds); @@ -108,68 +130,68 @@ public class FontController { Archive_Master master = new Archive_Master(); master.setPatientId(patientId); list = archiveMasterService.selectByObject(master); - if(null == list || list.isEmpty()){ - return retrunErrorPage(model,"记账号不存在!"); + if (null == list || list.isEmpty()) { + return retrunErrorPage(model, "记账号不存在!"); } } catch (Exception e) { ExceptionPrintUtil.printException(e); e.printStackTrace(); } List tPrintinfos = tPrintinfoMapper.selectIsPrintByPatienId(patientId); - model.addAttribute("printCount",tPrintinfos.size()); - model.addAttribute("patientId",list.get(0).getId()); - model.addAttribute("accountNumber",list.get(0).getPatientId()); - model.addAttribute("assortIds",assortIds); + model.addAttribute("printCount", tPrintinfos.size()); + model.addAttribute("patientId", list.get(0).getId()); + model.addAttribute("accountNumber", list.get(0).getPatientId()); + model.addAttribute("assortIds", assortIds); return "font/showRecord"; } /** * 提供第三方按用户名和记账号查询病历pdf - * */ + */ @RequestMapping("showRecordByOpId") - public String showRecordByPatientId(String userName, String opID,Integer delPower,Model model,HttpSession httpSession){ + public String showRecordByPatientId(String userName, String opID, Integer delPower, Model model, HttpSession httpSession) { //判断各参数 - if(StringUtils.isBlank(userName)){ - return retrunErrorPage(model,"工号不能为空!"); + if (StringUtils.isBlank(userName)) { + return retrunErrorPage(model, "工号不能为空!"); } - if(StringUtils.isBlank(opID)){ - return retrunErrorPage(model,"门诊号不能为空!"); + if (StringUtils.isBlank(opID)) { + return retrunErrorPage(model, "门诊号不能为空!"); } - List list = new ArrayList<>(); + List list = new ArrayList<>(); //判断工号是否存在 try { String checkUserName = checkUserName(userName); - if(StringUtils.isNotBlank(checkUserName)){ - return retrunErrorPage(model,checkUserName); + if (StringUtils.isNotBlank(checkUserName)) { + return retrunErrorPage(model, checkUserName); } //判断门诊号是否存在 - list = archiveOtherExtService.selectListBySysFlagAndJzh(-100,opID,null,null,null); - if(null == list || list.isEmpty()){ - return retrunErrorPage(model,"门诊号不存在!"); + list = archiveOtherExtService.selectListBySysFlagAndJzh(-100, opID, null, null, null); + if (null == list || list.isEmpty()) { + return retrunErrorPage(model, "门诊号不存在!"); } } catch (Exception e) { ExceptionPrintUtil.printException(e); e.printStackTrace(); } - model.addAttribute("jzh",opID); - if(list.size() > 1){ + model.addAttribute("jzh", opID); + if (list.size() > 1) { //个数超过一个,科室和主治医生置空 list.get(0).setC7(null); list.get(0).setC8(null); } - model.addAttribute("record",list.get(0)); - if(null == delPower || delPower != 1){ + model.addAttribute("record", list.get(0)); + if (null == delPower || delPower != 1) { delPower = 0; } - model.addAttribute("delPower",delPower); + model.addAttribute("delPower", delPower); return "font/showRecordByOpId"; } /** * 判断工号是否存在 */ - private String checkUserName(String userName){ + private String checkUserName(String userName) { String resultString = ""; String url = powerUrlHead + "/font/checkUserName?userName=" + userName; try { @@ -184,7 +206,7 @@ public class FontController { JSONObject jsonObject = JSONObject.fromObject(resultString); int code = jsonObject.getInt("code"); //code==200有错误信息 - if(code == temp){ + if (code == temp) { JSONObject extendObject1 = JSONObject.fromObject(jsonObject); return extendObject1.getString("msg"); } @@ -198,8 +220,8 @@ public class FontController { /** * 判断分类id是否存在 - * */ - private String checkAssortIds(String assortIds){ + */ + private String checkAssortIds(String assortIds) { Zd_Assort assort = new Zd_Assort(); assort.setPrintFlag("0"); List assortList = null; @@ -209,7 +231,7 @@ public class FontController { ExceptionPrintUtil.printException(e); e.printStackTrace(); } - if(null != assortList && !assortList.isEmpty()){ + if (null != assortList && !assortList.isEmpty()) { String[] split = assortIds.split(","); for (String s : split) { //定义分类存在 @@ -226,7 +248,7 @@ public class FontController { return "病案分类Id有误!"; } } - }else{ + } else { return "病案分类Id有误!"; } return null; @@ -234,53 +256,54 @@ public class FontController { /** * 跳转到showRecordIframe页面 - * */ + */ @RequestMapping("showRecordIframe") - public String showRecordIframe(){ + public String showRecordIframe() { return "font/showRecordIframe"; } /** * 跳转到recordPage页面 - * */ + */ @RequestMapping("recordPage") - public String recordPage(){ + public String recordPage() { return "font/recordPage"; } /** * 跳转到recordPage页面 - * */ + */ @RequestMapping("showRecord") - public String showRecord(){ + public String showRecord() { return "font/showRecord"; } /** * 根据主键查询病案详情 + * * @param masterId * @return */ @ResponseBody @RequestMapping(value = "/getRecord") - public String getPdfToPdf(String masterId){ + public String getPdfToPdf(String masterId) { try { Archive_Master archiveMaster = archiveMasterService.selectByPrimaryKey(masterId); //转换科室数据字典 - if(StringUtils.isNotBlank(archiveMaster.getDeptName())){ + if (StringUtils.isNotBlank(archiveMaster.getDeptName())) { Emr_Dictionary dictionary = new Emr_Dictionary(); dictionary.setCode(archiveMaster.getDeptName()); dictionary.setTypecode("dept_code"); List dictionaries = dictionaryMapper.dicByTypeCode(dictionary); - if(null != dictionaries && !dictionaries.isEmpty()){ + if (null != dictionaries && !dictionaries.isEmpty()) { archiveMaster.setDeptName(dictionaries.get(0).getName()); } //判断出院日期 String dischargeDateTime = archiveMaster.getDischargeDateTime(); - if(StringUtils.isNotBlank(dischargeDateTime)){ + if (StringUtils.isNotBlank(dischargeDateTime)) { SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd"); String time = fmt.format(fmt.parse(dischargeDateTime)); - if("1801-02-03".equals(time)){ + if ("1801-02-03".equals(time)) { archiveMaster.setDischargeDateTime(null); } } @@ -295,17 +318,18 @@ public class FontController { /** * 根据文件路径查询病案详情 + * * @param filePath 文件路径 * @return */ @ResponseBody @RequestMapping(value = "/getRecordByFilePath") - public String getRecordByFilePath(String filePath,String jzh){ + public String getRecordByFilePath(String filePath, String jzh) { try { - List list = archiveOtherExtService.selectListBySysFlagAndJzh(-100,jzh,null,null,filePath); - if(!CollectionUtils.isEmpty(list)){ + List list = archiveOtherExtService.selectListBySysFlagAndJzh(-100, jzh, null, null, filePath); + if (!CollectionUtils.isEmpty(list)) { return JSON.toJSONString(list.get(0)); - }else{ + } else { return null; } } catch (Exception e) { @@ -317,20 +341,21 @@ public class FontController { /** * 根据master表的记账号和分类id集合组织分类树 + * * @return * @throws Exception */ @ResponseBody @RequestMapping(value = "/getRecordTypeTree") - public String getRecordTypeTree(String patientId,String assortIds){ + public String getRecordTypeTree(String patientId, String assortIds) { List treeList = new ArrayList<>(); - if(StringUtils.isNotBlank(patientId) && StringUtils.isNotBlank(assortIds)){ + if (StringUtils.isNotBlank(patientId) && StringUtils.isNotBlank(assortIds)) { List list = new ArrayList<>(); //assortIds等于协商的全查的分类id,全查 try { - if(allAddortIds.equals(assortIds)){ + if (allAddortIds.equals(assortIds)) { list = archiveDetailService.selectTypeTreeByPatientIdAndAssortIds(patientId, null); - }else{ + } else { //否则按条件查 //分类id分别以单引号隔开 StringBuilder assortIdStr = new StringBuilder(); @@ -346,7 +371,7 @@ public class FontController { ExceptionPrintUtil.printException(e); e.printStackTrace(); } - if(null != list && !list.isEmpty()){ + if (null != list && !list.isEmpty()) { Set assortList = new LinkedHashSet<>(); //抽取首次病程记录 String strTemp = "首次病程"; @@ -357,14 +382,14 @@ public class FontController { Archive_Detail detailTemp = new Archive_Detail(); Archive_Detail nurseDetailVoTemp = new Archive_Detail(); //分类去重 - for(Archive_Detail detail : list){ + for (Archive_Detail detail : list) { assortList.add(detail.getSubassort()); //获取title String title = detail.getTitle(); - if(StringUtils.isNotBlank(title) && detail.getTitle().contains(strTemp)){ + if (StringUtils.isNotBlank(title) && detail.getTitle().contains(strTemp)) { detailTemp = detail; } - if(StringUtils.isNotBlank(title) && detail.getTitle().contains(nurseTemp)){ + if (StringUtils.isNotBlank(title) && detail.getTitle().contains(nurseTemp)) { nurseDetailVoTemp = detail; } } @@ -383,7 +408,7 @@ public class FontController { treeList.add(tree); oneParentId = id; id++; - for(String assortName : assortList){ + for (String assortName : assortList) { AssortTypeTree tree1 = new AssortTypeTree(); //第二层,分类名称 tree1.setId(id); @@ -395,12 +420,12 @@ public class FontController { //定义是否添加了首次病程 boolean flag = false; boolean nurseflag = false; - for(Archive_Detail detail : list){ - if(StringUtils.isNotBlank(detail.getSubassort()) && assortName.equals(detail.getSubassort())){ + for (Archive_Detail detail : list) { + if (StringUtils.isNotBlank(detail.getSubassort()) && assortName.equals(detail.getSubassort())) { String assortid = detail.getAssortid(); - if(StringUtils.isNotBlank(assortid) && assortid.equals(assortId)){ + if (StringUtils.isNotBlank(assortid) && assortid.equals(assortId)) { //是病程记录 - if(!flag && StringUtils.isNotBlank(detailTemp.getTitle())){ + if (!flag && StringUtils.isNotBlank(detailTemp.getTitle())) { AssortTypeTree tree2 = new AssortTypeTree(); //第三层,资料名称 count++; @@ -414,9 +439,9 @@ public class FontController { flag = true; } } - if(StringUtils.isNotBlank(assortid) && assortid.equals(nurseAssortId)){ + if (StringUtils.isNotBlank(assortid) && assortid.equals(nurseAssortId)) { //是护理记录 - if(!nurseflag && StringUtils.isNotBlank(nurseDetailVoTemp.getTitle())){ + if (!nurseflag && StringUtils.isNotBlank(nurseDetailVoTemp.getTitle())) { AssortTypeTree tree2 = new AssortTypeTree(); //第三层,资料名称 count++; @@ -430,7 +455,7 @@ public class FontController { nurseflag = true; } } - if(!detail.equals(detailTemp) && !detail.equals(nurseDetailVoTemp)) { + if (!detail.equals(detailTemp) && !detail.equals(nurseDetailVoTemp)) { AssortTypeTree tree2 = new AssortTypeTree(); //第三层,资料名称 count++; @@ -444,7 +469,7 @@ public class FontController { } } } - tree1.setName(assortName + "("+count+")"); + tree1.setName(assortName + "(" + count + ")"); tree1.setChecked("true"); treeList.add(tree1); } @@ -455,20 +480,21 @@ public class FontController { /** * 根据archive_other_ext表的记账号和时间组合组织分类树 + * * @return * @throws Exception */ @ResponseBody @RequestMapping(value = "/getRecordTypeTreeByOpId") - public String getRecordTypeTreeByOpId(String jzh,Integer isSearch,String startDateTo,String endDateTo){ + public String getRecordTypeTreeByOpId(String jzh, Integer isSearch, String startDateTo, String endDateTo) { List treeList = new ArrayList<>(); - if(StringUtils.isNotBlank(jzh)){ + if (StringUtils.isNotBlank(jzh)) { List list = new ArrayList<>(); //assortIds等于协商的全查的分类id,全查 try { - list = archiveOtherExtService.selectListBySysFlagAndJzh(-100,jzh,startDateTo,endDateTo,null); + list = archiveOtherExtService.selectListBySysFlagAndJzh(-100, jzh, startDateTo, endDateTo, null); List dateList = new ArrayList<>(); - if(!CollectionUtils.isEmpty(list)) { + if (!CollectionUtils.isEmpty(list)) { //开始时间为空时,取集合最后一个时间 if (StringUtils.isBlank(startDateTo)) { startDateTo = list.get(list.size() - 1).getSysupdatetimeStr(); @@ -496,7 +522,7 @@ public class FontController { treeList.add(tree); oneParentId = id; id++; - if(!CollectionUtils.isEmpty(dateList) && !CollectionUtils.isEmpty(list)) { + if (!CollectionUtils.isEmpty(dateList) && !CollectionUtils.isEmpty(list)) { SimpleDateFormat fmt = new SimpleDateFormat("yyyyMMdd"); SimpleDateFormat fmt1 = new SimpleDateFormat("yyyy-MM-dd"); for (String date : dateList) { @@ -547,22 +573,23 @@ public class FontController { /** * 根据病案号或类别或图片id获取图片列表,并生成PDF并返回pdf文件名 + * * @param response * @param detailIds * @return * @throws Exception */ @ResponseBody - @RequestMapping(value = "/getPdfToPdf",method = RequestMethod.POST) - public Msg getPdfToPdf(HttpServletResponse response,String detailIds,HttpSession session){ + @RequestMapping(value = "/getPdfToPdf", method = RequestMethod.POST) + public Msg getPdfToPdf(HttpServletResponse response, String detailIds, HttpSession session) { try { Archive_Detail detail = new Archive_Detail(); - if(StringUtils.isNotBlank(detailIds)){ + if (StringUtils.isNotBlank(detailIds)) { detail.setTitle(detailIds); - archiveDetailService.selectByIdStrFont(response,session,detail); - }else{ + archiveDetailService.selectByIdStrFont(response, session, detail); + } else { //存至session - session.setAttribute("showRecord",null); + session.setAttribute("showRecord", null); } return Msg.success(); } catch (Exception e) { @@ -574,28 +601,29 @@ public class FontController { /** * 根据pdf文件名列表 + * * @param detailIds * @return * @throws Exception */ @ResponseBody - @RequestMapping(value = "/getPdfToPdfByOpId",method = RequestMethod.POST) - public Msg getPdfToPdfByOpId(String detailIds,HttpSession session){ + @RequestMapping(value = "/getPdfToPdfByOpId", method = RequestMethod.POST) + public Msg getPdfToPdfByOpId(String detailIds, HttpSession session) { try { - if(StringUtils.isNotBlank(detailIds)){ - List pathList= new ArrayList<>(); + if (StringUtils.isNotBlank(detailIds)) { + List pathList = new ArrayList<>(); String[] filePathArr = detailIds.split(","); - for(String pdfFilePath : filePathArr){ - if(StringUtils.isNotBlank(pdfFilePath)){ + for (String pdfFilePath : filePathArr) { + if (StringUtils.isNotBlank(pdfFilePath)) { pdfFilePath = pdfFilePath.replaceAll("\'", ""); pathList.add(pdfFilePath); } } //存至session - session.setAttribute("showRecord",pathList); - }else{ + session.setAttribute("showRecord", pathList); + } else { //存至session - session.setAttribute("showRecord",null); + session.setAttribute("showRecord", null); } return Msg.success(); } catch (Exception e) { @@ -604,11 +632,12 @@ public class FontController { //e.printStackTrace(); } } + @ResponseBody @RequestMapping(value = "showPdf") - public void showPdf(HttpServletResponse response,HttpSession session){ + public void showPdf(HttpServletResponse response, HttpSession session) { try { - archiveDetailService.showPdf(response,session,pdfWater); + archiveDetailService.showPdf(response, session, pdfWater); } catch (Exception e) { ExceptionPrintUtil.printException(e); } @@ -617,132 +646,374 @@ public class FontController { /** * 返回错误页面 - * */ - private String retrunErrorPage(Model model,String errorMsg){ - model.addAttribute("errorMsg",errorMsg); + */ + private String retrunErrorPage(Model model, String errorMsg) { + model.addAttribute("errorMsg", errorMsg); return "font/error"; } /** * 对外预览病案接口页面点击刷新按钮 * 按需采集 + * * @param patientId 记账号 * @return * @throws Exception */ - @RequestMapping(value="updateArchiveOther",method = RequestMethod.POST) + @RequestMapping(value = "updateArchiveOther", method = RequestMethod.POST) @ResponseBody - public Msg updateArchiveOther(String patientId,String masterId) throws Exception{ - if(StringUtils.isBlank(patientId)){ + public Msg updateArchiveOther(String patientId, String masterId) throws Exception { + if (StringUtils.isBlank(patientId)) { return Msg.fail("记账号不能为空,请联系系统管理员"); } - if(StringUtils.isBlank(masterId)){ + if (StringUtils.isBlank(masterId)) { return Msg.fail("masterId不能为空,请联系系统管理员"); } //查询是否已归档 Archive_Master master = archiveMasterService.selectByPrimaryKey(masterId); //获取状态码 String archivestate = master.getArchivestate(); - if(StringUtils.isNotBlank(archivestate) && "128".equals(archivestate)){ + if (StringUtils.isNotBlank(archivestate) && "128".equals(archivestate)) { //已归档 - return Msg.success().add("data",1); + return Msg.success().add("data", 1); } - archiveOtherService.updateArchiveOther(patientId,masterId); + archiveOtherService.updateArchiveOther(patientId, masterId); return Msg.success(); } /** * 根据记账号实时查询archiveOther的C1字段是否变更为done + * * @param patientId 记账号 * @return * @throws Exception */ @RequestMapping("selectC1ByPatientId") @ResponseBody - public Msg selectC1ByPatientId(String patientId) throws Exception{ + public Msg selectC1ByPatientId(String patientId) throws Exception { int count = archiveOtherService.selectC1ByPatientId(patientId); - if(count == 1){ + if (count == 1) { return Msg.success(); - }else{ + } else { return null; } } /** * 根据masterId查询流程明细 + * * @param masterId * @return * @throws Exception */ @RequestMapping("toShowFlowInfo") @ResponseBody - public Msg toShowFlowInfo(String masterId, String userName) throws Exception{ - List list = archiveFlowInfoService.selectFlowInfoByMasterId(masterId,userName); - return Msg.success().add("list",list); + public Msg toShowFlowInfo(String masterId, String userName) throws Exception { + List list = archiveFlowInfoService.selectFlowInfoByMasterId(masterId, userName); + return Msg.success().add("list", list); } /** * 根据masterId查询流程明细 + * * @return * @throws Exception */ @RequestMapping("selectDeptList") @ResponseBody - public Msg selectDeptList() throws Exception{ - List list = dictionaryMapper.selectAllByParentId("dept_code",null); - return Msg.success().add("list",list); + public Msg selectDeptList() throws Exception { + List list = dictionaryMapper.selectAllByParentId("dept_code", null); + return Msg.success().add("list", list); } /** * 其他档案接口删除功能,将statusFlag 赋值-1 + * * @return * @throws Exception */ - @RequestMapping(value="updateOtherDomForStatusFlag",method = RequestMethod.POST) + @RequestMapping(value = "updateOtherDomForStatusFlag", method = RequestMethod.POST) @ResponseBody - public Msg updateOtherDomForStatusFlag(String jzh,String detailIds) throws Exception{ - if(StringUtils.isBlank(jzh)){ + public Msg updateOtherDomForStatusFlag(String jzh, String detailIds) throws Exception { + if (StringUtils.isBlank(jzh)) { return Msg.fail("门诊号不能为空"); } - if(StringUtils.isBlank(detailIds)){ + if (StringUtils.isBlank(detailIds)) { return Msg.fail("文档对象不能为空"); } - archiveOtherExtService.updateOtherDomForStatusFlag(jzh,detailIds); + archiveOtherExtService.updateOtherDomForStatusFlag(jzh, detailIds); return Msg.success(); } /** * 其他档案接口删除功能,将statusFlag 赋值-1 + * * @return * @throws Exception */ - @RequestMapping(value="getMaster") + @RequestMapping(value = "getMaster") @ResponseBody - public OffsetLimitPage getMaster(Archive_Master_Vo archiveMasterVo, Integer offset, Integer limit, HttpServletRequest request) throws Exception{ + public OffsetLimitPage getMaster(Archive_Master_Vo archiveMasterVo, Integer offset, Integer limit, HttpServletRequest request) throws Exception { //如果前端主管医生字段有选全部选项,则查全部数据 - String[] doctorInCharge=archiveMasterVo.getDoctorInCharge().split(","); - int i=doctorInCharge.length; - if(doctorInCharge.length>1&&StringUtils.isBlank(doctorInCharge[0])&&StringUtils.isNotBlank(doctorInCharge[1])){ + String[] doctorInCharge = archiveMasterVo.getDoctorInCharge().split(","); + int i = doctorInCharge.length; + if (doctorInCharge.length > 1 && StringUtils.isBlank(doctorInCharge[0]) && StringUtils.isNotBlank(doctorInCharge[1])) { archiveMasterVo.setDoctorInCharge(""); } - return archiveMasterService.selectMasterByColumn(archiveMasterVo, offset, limit,request); + return archiveMasterService.selectMasterByColumn(archiveMasterVo, offset, limit, request); } + /** * 其他档案接口删除功能,将statusFlag 赋值-1 + * * @return * @throws Exception */ - @RequestMapping(value="getAssortIds") + @RequestMapping(value = "getAssortIds") @ResponseBody - public String getAssortIds(String masterId) throws Exception{ - String ids=archiveMasterService.selectAssortIdsByMasterId(masterId); - if(StringUtils.isNotBlank(ids)){ - HashMap returnMap=new HashMap(); - returnMap.put("assortIds",ids.substring(0, ids.length() - 1)); + public String getAssortIds(String masterId) throws Exception { + String ids = archiveMasterService.selectAssortIdsByMasterId(masterId); + if (StringUtils.isNotBlank(ids)) { + HashMap returnMap = new HashMap(); + returnMap.put("assortIds", ids.substring(0, ids.length() - 1)); return JSON.toJSONString(returnMap); - }else{ + } else { return null; } } + private Map parseXml2Map(String xml, Map map) { + try { + SAXReader reader = new SAXReader(); + Document doc = reader.read(new StringReader(xml)); + Element root = doc.getRootElement(); + String path = ""; + if (map.containsKey(root.getName().trim())) { + path = map.get(root.getName().trim()); + map.remove(root.getName().trim()); + } + for (Iterator i = root.elementIterator(); i.hasNext(); ) { + Element element = (Element) i.next(); + if (element.isTextOnly()) { + if (path.length() > 0) { + map.put(path + element.getName().trim(), element.getTextTrim()); + } else { + map.put(element.getName().trim(), element.getTextTrim()); + } + } else { + map.put(element.getName().trim(), path + element.getName().trim() + "."); + parseXml2Map(element.asXML(), map); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + return map; + } + + /** + * 调用第三方接口获取唯一标识patientid + * + * @return + * @throws Exception + */ + @RequestMapping(value = "getRoomDetails") + @ResponseBody + public String selRoomDetails(EsbPublicVo esbPublicVo,SecureloginVo secureloginVo, HttpServletRequest request) throws Exception { + //创建连接工厂 + String patientId1 = esbPublicVo.getPatientId(); + System.out.println("patientId1:::::"+patientId1); + JAXDynamicClientFactory dcf = JAXDynamicClientFactory.newInstance(); + //创建客户端 wsUrl为webService接口地址 + Client client = dcf.createClient(RoomDetailsUrl); + String xmlStr = createXml(patientId1); + Object[] objects = client.invoke(RoomDetailsUrlName, xmlStr); + //销毁连接 + client.destroy(); + //接收结果 + String result = objects[0].toString(); + System.out.println("result::::::"+result); + String patientId=null; + if (StringUtils.isNotBlank(result)) { + Map map = new HashMap<>(); + map = parseXml2Map(result, map); + //获取序列号 + patientId = map.get("Body.ResultContent.patientid"); + + } + // 获得Http客户端 + CloseableHttpClient httpClient = HttpClientBuilder.create().build(); + // 创建Post请求 + HttpPost httpPost = new HttpPost("http://10.100.12.12:37727/api/account/securelogin"); + //json格式转换 + JSONObject jsonParam = new JSONObject(); + jsonParam.put("idp","NSDP"); + jsonParam.put("secret", "Secret"); + jsonParam.put("userName","002030"); + jsonParam.put("password", "123456"); + jsonParam.put("scopes", "openid profile cr-api roles"); + jsonParam.put("key", patientId1); + System.out.println(jsonParam); + StringEntity entity = new StringEntity(jsonParam.toString(), "UTF-8"); + httpPost.setEntity(entity); + httpPost.setHeader("Content-Type","application/json"); + // 响应模型 + CloseableHttpResponse response = null; + HttpEntity responseEntity=null; + String token=""; + String s =""; + try { + // 由客户端执行(发送)Post请求 + response = httpClient.execute(httpPost); + // 从响应模型中获取响应实体 + responseEntity=response.getEntity(); + System.out.println("响应状态为:" + response.getStatusLine()); + if (responseEntity != null) { + Map mapType = JSON.parseObject(EntityUtils.toString(responseEntity),Map.class); + token = mapType.get("token").toString(); + System.out.println("token:::"+token); + s = StringUtils.substringAfter(token, " "); + System.out.println("s:::"+s); + } + } catch (ClientProtocolException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + try { + // 释放资源 + if (httpClient != null) { + httpClient.close(); + } + if (response != null) { + response.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + String pdfUrl="http://10.100.12.3:33600/view/subjects/"+patientId+"/records/"+secureloginVo.getVisitId()+"?token="+s+"&token_type=Bearer"; + return pdfUrl; + } + + + /* + * +
+ HIS + D561C89A-6320-4b27-83DE-A6169B1D0761 + 2021-07-18 11:12:41 + Get360PatientId +
+ + 0000623132 + +
+ * */ + public static String createXml(String patientId1){ + String strXML =null; + try { +// Document document = DocumentHelper.createDocument(); +// org.dom4j.Element request = document.addElement("Request"); +// org.dom4j.Element header = request.addElement("Header"); +// org.dom4j.Element sourceSystem = header.addElement("SourceSystem"); +// org.dom4j.Element messageId = header.addElement("MessageId"); +// org.dom4j.Element createTime = header.addElement("CreateTime"); +// org.dom4j.Element methodName = header.addElement("MethodName"); +// sourceSystem.setText("record"); +// messageId.setText(UUID.randomUUID().toString().toUpperCase()); +// createTime.setText(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); +// methodName.setText("Get360PatientId"); +// org.dom4j.Element body = request.addElement("Body"); +// Element patientIdEle = body.addElement("PatientId"); +// patientIdEle.setText(patientId); +// return document.toString(); + Document document = DocumentHelper.createDocument(); + //创建根节点 + Element request = document.addElement("Request"); + //添加子节点 + Element header = request.addElement("Header"); + //给Header标签添加子节点 + Element sourceSystem = header.addElement("SourceSystem"); + Element messageId = header.addElement("MessageId"); + Element createTime = header.addElement("CreateTime"); + Element methodName = header.addElement("MethodName"); + //给Request标签添加子节点 + Element body = request.addElement("Body"); + //给Body标签添加子节点 + Element patientIdEle = body.addElement("PatientId"); + //给xml赋值 + sourceSystem.addText("CaseSys"); + UUID guid = UUID.randomUUID(); + messageId.addText(guid.toString()); + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + createTime.addText(df.format(new Date())); + methodName.addText("Get360PatientId"); + patientIdEle.addText(patientId1); + strXML = document.asXML(); + System.out.println("strXML:::::"+strXML); + } catch (Exception e) { + System.out.println("生成rssNew.xml失败"); + } + return strXML; + } + /** + * 获取token + * @return + * @throws + */ + @RequestMapping(value="getToken") + @ResponseBody + public void selToken(SecureloginVo secureloginVo, HttpServletRequest request){ + System.out.println(secureloginVo.getKey()); + // 获得Http客户端 + CloseableHttpClient httpClient = HttpClientBuilder.create().build(); + // 创建Post请求 + HttpPost httpPost = new HttpPost("http://10.100.12.12:37727/api/account/securelogin"); + secureloginVo.setIDP("NSDP"); + secureloginVo.setSecret("Secret"); +// Power_User user = (Power_User)request.getSession().getAttribute("CURRENT_USER"); +// secureloginVo.setUserName(user.getUserName()); + secureloginVo.setUserName("002030"); + secureloginVo.setPassword("123456"); + secureloginVo.setScopes("openid profile cr-api roles"); + + //json格式转换 + String jsonString = JSON.toJSONString(secureloginVo); + StringEntity entity = new StringEntity(jsonString, "UTF-8"); + // post请求是将参数放在请求体里面传过去的;这里将entity放入post请求体中 + httpPost.setEntity(entity); + httpPost.setHeader("Content-Type", "application/json;charset=utf8"); + // 响应模型 + CloseableHttpResponse response = null; + try { + // 由客户端执行(发送)Post请求 + response = httpClient.execute(httpPost); + // 从响应模型中获取响应实体 + HttpEntity responseEntity = response.getEntity(); + System.out.println("responseEntity::::"+responseEntity); + System.out.println("响应状态为:" + response.getStatusLine()); + if (responseEntity != null) { + System.out.println("响应内容长度为:" + responseEntity.getContentLength()); + System.out.println("响应内容为:" + EntityUtils.toString(responseEntity)); + } + } catch (ClientProtocolException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + try { + // 释放资源 + if (httpClient != null) { + httpClient.close(); + } + if (response != null) { + response.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } diff --git a/src/main/java/com/emr/controller/JAXDynamicClientFactory.java b/src/main/java/com/emr/controller/JAXDynamicClientFactory.java index bf16514..92da15e 100644 --- a/src/main/java/com/emr/controller/JAXDynamicClientFactory.java +++ b/src/main/java/com/emr/controller/JAXDynamicClientFactory.java @@ -34,6 +34,13 @@ public class JAXDynamicClientFactory extends DynamicClientFactory { return true; } + public static JAXDynamicClientFactory newInstance(Bus b) { + return new JAXDynamicClientFactory(b); + } + + + + public static JAXDynamicClientFactory newInstance() { Bus bus = CXFBusFactory.getThreadDefaultBus(); return new JAXDynamicClientFactory(bus); diff --git a/src/main/java/com/emr/controller/LoginController.java b/src/main/java/com/emr/controller/LoginController.java index 8141ae8..80cfba2 100644 --- a/src/main/java/com/emr/controller/LoginController.java +++ b/src/main/java/com/emr/controller/LoginController.java @@ -56,8 +56,8 @@ public class LoginController { String userName = request.getParameter("userName"); String flag = request.getParameter("flag"); if(StringUtils.isNoneBlank(token)){ - //高明归档特殊token=1462903487866169011 - if("1462903487866169011".equals(token)){ + //高明归档特殊token=1462903487866169011 + if("1462903487866169011".equals(token)){ //请求权限系统根据用户名登录换取token String requestUrl = POWER_URLHEAD + "/font/getToken?userName="+userName+"&password="+token; JSONObject obj = HttpClientUtils.httpGet(requestUrl); diff --git a/src/main/java/com/emr/util/DateUtil.java b/src/main/java/com/emr/util/DateUtil.java index ed5db39..8e19905 100644 --- a/src/main/java/com/emr/util/DateUtil.java +++ b/src/main/java/com/emr/util/DateUtil.java @@ -1,6 +1,6 @@ package com.emr.util; -import com.sun.tools.example.debug.expr.ParseException; + import java.text.DateFormat; import java.text.SimpleDateFormat; diff --git a/src/main/java/com/emr/vo/EsbPublicVo.java b/src/main/java/com/emr/vo/EsbPublicVo.java new file mode 100644 index 0000000..7be3cc9 --- /dev/null +++ b/src/main/java/com/emr/vo/EsbPublicVo.java @@ -0,0 +1,62 @@ +package com.emr.vo; + +import lombok.Data; + + +public class EsbPublicVo { + private String sourceSystem; + private String messageId; + private String createTime; + + public String getSourceSystem() { + return sourceSystem; + } + + public void setSourceSystem(String sourceSystem) { + this.sourceSystem = sourceSystem; + } + + public String getMessageId() { + return messageId; + } + + public void setMessageId(String messageId) { + this.messageId = messageId; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getMethodName() { + return methodName; + } + + public void setMethodName(String methodName) { + this.methodName = methodName; + } + + public String getPatientId() { + return patientId; + } + + public void setPatientId(String patientId) { + this.patientId = patientId; + } + + public String getJumpUrl() { + return jumpUrl; + } + + public void setJumpUrl(String jumpUrl) { + this.jumpUrl = jumpUrl; + } + + private String methodName; + private String patientId; + private String jumpUrl; +} diff --git a/src/main/java/com/emr/vo/SecureloginVo.java b/src/main/java/com/emr/vo/SecureloginVo.java new file mode 100644 index 0000000..f2df1dc --- /dev/null +++ b/src/main/java/com/emr/vo/SecureloginVo.java @@ -0,0 +1,79 @@ +package com.emr.vo; + + + +public class SecureloginVo { + private String idp; + private String secret; + private String userName; + private String visitId; + + public String getVisitId() { + return visitId; + } + + public void setVisitId(String visitId) { + this.visitId = visitId; + } + + public String getIdp() { + return idp; + } + + public void setIDP(String idp) { + this.idp = idp; + } + + public String getSecret() { + return secret; + } + + public void setSecret(String secret) { + this.secret = secret; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getScopes() { + return scopes; + } + + public void setScopes(String scopes) { + this.scopes = scopes; + } + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public String getPatientId() { + return patientId; + } + + public void setPatientId(String patientId) { + this.patientId = patientId; + } + + private String password; + private String scopes; + private String key; + private String patientId; +} diff --git a/src/main/webapp/static/js/record/recordPage.js b/src/main/webapp/static/js/record/recordPage.js index e77bb67..e0627a9 100644 --- a/src/main/webapp/static/js/record/recordPage.js +++ b/src/main/webapp/static/js/record/recordPage.js @@ -149,28 +149,15 @@ function initTable() { events: { //查看 'click .selInfo': function (e, value, row) { - $("#patientId").val(row.id); $.ajax({ - type:'get', - url:path+'/font/getAssortIds', - data:{masterId:row.id}, - async:false, - dataType:'json', + type:'post', + url:path+'/font/getRoomDetails', + data:{patientId:row.patientId,visitId:row.visitId}, success:function (data) { - if(null != data && data != ''){ - $("#assortIds").val(data.assortIds); - } + var openWin = window.open(data); + setTimeout(function(){ openWin.document.title = $("#nameLab").text(); }, 100); } }) - var patientId=row.id; - //加载病案信息 - loadRecord(); - //加载iframe - $("#main").hide(); - $("#main1").hide() - var pdfUrl = path+"/font/showRecord?patientId="+patientId+"&assortIds="+$("#assortIds").val(); - var openWin = window.open(pdfUrl,"_blank"); - setTimeout(function(){ openWin.document.title = $("#nameLab").text(); }, 100); }, //查看流程 'click .showFlowInfo': function (e, value, row) {