佛山三院360接口对接

master
ALW 3 years ago
parent 35b9b4db49
commit 46bf79d480

@ -126,6 +126,18 @@
<version>${aspectj.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>3.1.8</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>3.1.8</version>
</dependency>
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
@ -231,6 +243,18 @@
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jdom</groupId>
<artifactId>jdom</artifactId>
<version>1.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/dom4j/dom4j -->
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
</dependency>
</dependencies>
<build>

@ -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***********************************/
/**
* idpdf
* */
*/
@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<Archive_Master> list = new ArrayList<>();
List<Archive_Master> 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<TPrintinfo> 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<ArchiveOtherExtVo> list = new ArrayList<>();
List<ArchiveOtherExtVo> 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<Zd_Assort> 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<Emr_Dictionary> 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<ArchiveOtherExtVo> list = archiveOtherExtService.selectListBySysFlagAndJzh(-100,jzh,null,null,filePath);
if(!CollectionUtils.isEmpty(list)){
List<ArchiveOtherExtVo> 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 {
/**
* masterid
*
* @return
* @throws Exception
*/
@ResponseBody
@RequestMapping(value = "/getRecordTypeTree")
public String getRecordTypeTree(String patientId,String assortIds){
public String getRecordTypeTree(String patientId, String assortIds) {
List<AssortTypeTree> treeList = new ArrayList<>();
if(StringUtils.isNotBlank(patientId) && StringUtils.isNotBlank(assortIds)){
if (StringUtils.isNotBlank(patientId) && StringUtils.isNotBlank(assortIds)) {
List<Archive_Detail> 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<String> 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<AssortTypeTree> treeList = new ArrayList<>();
if(StringUtils.isNotBlank(jzh)){
if (StringUtils.isNotBlank(jzh)) {
List<ArchiveOtherExtVo> list = new ArrayList<>();
//assortIds等于协商的全查的分类id全查
try {
list = archiveOtherExtService.selectListBySysFlagAndJzh(-100,jzh,startDateTo,endDateTo,null);
list = archiveOtherExtService.selectListBySysFlagAndJzh(-100, jzh, startDateTo, endDateTo, null);
List<String> 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 {
/**
* idPDFpdf
*
* @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<String> pathList= new ArrayList<>();
if (StringUtils.isNotBlank(detailIds)) {
List<String> 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();
}
/**
* archiveOtherC1done
*
* @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<ArchiveFlowInfoVo> list = archiveFlowInfoService.selectFlowInfoByMasterId(masterId,userName);
return Msg.success().add("list",list);
public Msg toShowFlowInfo(String masterId, String userName) throws Exception {
List<ArchiveFlowInfoVo> list = archiveFlowInfoService.selectFlowInfoByMasterId(masterId, userName);
return Msg.success().add("list", list);
}
/**
* masterId
*
* @return
* @throws Exception
*/
@RequestMapping("selectDeptList")
@ResponseBody
public Msg selectDeptList() throws Exception{
List<Emr_Dictionary> list = dictionaryMapper.selectAllByParentId("dept_code",null);
return Msg.success().add("list",list);
public Msg selectDeptList() throws Exception {
List<Emr_Dictionary> 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<String, String> parseXml2Map(String xml, Map<String, String> 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<String, String> 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<String,Object> 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;
}
/*
* <Request>
<Header>
<SourceSystem>HIS</SourceSystem>
<MessageId>D561C89A-6320-4b27-83DE-A6169B1D0761</MessageId>
<CreateTime>2021-07-18 11:12:41</CreateTime>
<MethodName>Get360PatientId</MethodName>
</Header>
<Body>
<PatientId>0000623132</PatientId>
</Body>
</Request>
* */
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();
}
}
}
}

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

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

@ -1,6 +1,6 @@
package com.emr.util;
import com.sun.tools.example.debug.expr.ParseException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;

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

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

@ -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) {

Loading…
Cancel
Save