| | |
| | | package com.smartor.service.impl; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.json.JSON; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.ruoyi.common.core.domain.entity.SysDept; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.domain.entity.SysUserDept; |
| | |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.DtoConversionUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.http.HttpUtils; |
| | | import com.smartor.domain.*; |
| | | import com.smartor.domain.entity.ServiceSubtaskEntity; |
| | | import com.smartor.mapper.*; |
| | | import com.smartor.service.IPatMedOuthospService; |
| | | import com.smartor.service.IServiceExternalService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import netscape.javascript.JSObject; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | @Override |
| | | public Map<String, Object> query360PatInfolwl(Long patid, SysUser sysUser) { |
| | | Map<String, Object> result = new HashMap<>(); |
| | | PatArchive pa = patArchiveMapper.selectPatArchiveByPatid(patid); |
| | | if (pa.getPatientno() == null) { |
| | | result.put("url", null); |
| | | result.put("error", "患者编号为空"); |
| | | return result; |
| | | PatArchive patArchive = patArchiveMapper.selectPatArchiveByPatid(patid); |
| | | Map<String, String> headers = buildRequestHeaders(); |
| | | Map<String, Object> requestParams = buildRequestParams(sysUser,patArchive); |
| | | String result = HttpUtils.sendPostByHeader("http://cfdata.nhyfy.cn/kapi/hbos-h360/open/getNoLoginUrl", new Gson().toJson(requestParams), headers); |
| | | log.info("============result的值为:{}",result); |
| | | Gson gson = new Gson(); |
| | | Map<String, Object> map = null; |
| | | if (result != null) { |
| | | map = gson.fromJson(result, new TypeToken<Map<String, Object>>() { |
| | | }.getType()); |
| | | } |
| | | |
| | | StringBuffer sbf = new StringBuffer("http://cfdata.nhyfy.cn/cfdata/h360/patient-summary?"); |
| | | sbf.append("referer=thirdparty"); |
| | | sbf.append("&encode=1"); |
| | | sbf.append("&patientMainIndexNum=" + AesUtils.encrypt(pa.getPatientno())); |
| | | sbf.append("&workId=" + AesUtils.encrypt(sysUser.getUserName())); |
| | | sbf.append("&workName=" + AesUtils.encrypt(sysUser.getNickName())); |
| | | sbf.append("&hisOrgCode=" + AesUtils.encrypt("20001001")); |
| | | sbf.append("&hisOrgName=" + AesUtils.encrypt("南华大学附属第一医院")); |
| | | sbf.append("&hisHosCode=" + AesUtils.encrypt("30001002")); |
| | | sbf.append("&hisHosName=" + AesUtils.encrypt("南华大学附属第一医院")); |
| | | String url360 = null; |
| | | try { |
| | | url360 = URLEncoder.encode(sbf.toString(), "UTF-8"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | |
| | | StringBuffer stringBuffer = new StringBuffer("http://cfdata.nhyfy.cn/cfdata/login/nologin?"); |
| | | //accountNo对接人不给,先空着--------------------------------------------------------------- |
| | | stringBuffer.append("accountNo="); |
| | | stringBuffer.append("&source=third"); |
| | | stringBuffer.append("&redirectUrl=" + url360); |
| | | |
| | | result.put("url", stringBuffer.toString()); |
| | | result.put("error", null); |
| | | return result; |
| | | return map; |
| | | } |
| | | |
| | | private Boolean getType(String type, Map dataMap) { |
| | |
| | | return ageMap; |
| | | } |
| | | |
| | | |
| | | private Map<String, String> buildRequestHeaders() { |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("Content-Type", "application/json"); |
| | | headers.put("app-key", "ak-0p5Qi0J1I4AL67ztEYQL1j9v"); |
| | | return headers; |
| | | } |
| | | |
| | | private Map<String, Object> buildRequestParams(SysUser sysUser,PatArchive patArchive) { |
| | | Map<String, Object> requestParams = new HashMap<>(); |
| | | requestParams.put("key", sysUser.getUserName()); |
| | | requestParams.put("windowOpen", false); |
| | | requestParams.put("isShowHeader", false); |
| | | requestParams.put("encode", 1); |
| | | |
| | | Map<String, Object> params = new HashMap<>(); |
| | | //病历号 |
| | | params.put("patientMainIndexNum", patArchive.getPatientno()); |
| | | params.put("sourceSystem", "pacs"); |
| | | params.put("workId", sysUser.getUserName()); |
| | | params.put("workName", sysUser.getNickName()); |
| | | params.put("hisDepName", sysUser.getDeptName()); |
| | | params.put("hisDepCode", sysUser.getDeptCode()); |
| | | params.put("hisOrgName", "南华大学附属第一医院"); |
| | | params.put("hisOrgCode", "20001001"); |
| | | params.put("hisHosName", "南华大学附属第一医院"); |
| | | params.put("hisHosCode", "30001002"); |
| | | requestParams.put("params", params); |
| | | return requestParams; |
| | | } |
| | | |
| | | } |