From e32414ce775fefdd0602ac96c218c4f0758f7033 Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期二, 21 七月 2026 15:54:21 +0800
Subject: [PATCH] 【丽水】同步经管医生
---
smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java | 137 ++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 132 insertions(+), 5 deletions(-)
diff --git a/smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java
index aab600e..382ef76 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java
@@ -1,21 +1,27 @@
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.core.redis.RedisCache;
import com.ruoyi.common.exception.base.BaseException;
+import com.ruoyi.common.utils.AesUtils;
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;
@@ -24,6 +30,8 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
@@ -427,18 +435,23 @@
Map yeWuXX = (Map) dataMap.get("YeWuXX");
Map<String, Object> BingRenXX = ObjectUtils.isNotEmpty(yeWuXX) ? (Map<String, Object>) yeWuXX.get("BingRenXX") : null;
Map<String, Object> RuKeXX = ObjectUtils.isNotEmpty(yeWuXX) ? (Map<String, Object>) yeWuXX.get("RuKeXX") : null;
+ Map<String, Object> JiuZhenXX = ObjectUtils.isNotEmpty(yeWuXX) ? (Map<String, Object>) yeWuXX.get("JiuZhenXX") : null;
List<HashMap<String, Object>> epai = ObjectUtils.isNotEmpty(yeWuXX) ? (List<HashMap<String, Object>>) BingRenXX.get("DiZhiXXList") : null;
ExternalInHospPatientInfo externalInHospPatientInfo = BeanUtil.mapToBean(BingRenXX, ExternalInHospPatientInfo.class, true);
ExternalInDeptPatientInfo externalInDeptPatientInfo = BeanUtil.mapToBean(RuKeXX, ExternalInDeptPatientInfo.class, true);
+
+ ExternalInDeptPatientInfo externalJZInfo = BeanUtil.mapToBean(JiuZhenXX, ExternalInDeptPatientInfo.class, true);
+ if(ObjectUtils.isNotEmpty(externalJZInfo)){
+ externalInHospPatientInfo.setJingGuanYSID(externalJZInfo.getJingGuanYSID());
+ externalInHospPatientInfo.setJingGuanYSXM(externalJZInfo.getJingGuanYSXM());
+ }
externalInHospPatientInfo.setZeRenHSID(externalInDeptPatientInfo.getZeRenHSID());
externalInHospPatientInfo.setZeRenHSXM(externalInDeptPatientInfo.getZeRenHSXM());
externalInHospPatientInfo.setZhuZhiYSID(externalInDeptPatientInfo.getZhuZhiYSID());
externalInHospPatientInfo.setZhuZhiYSXM(externalInDeptPatientInfo.getZhuZhiYSXM());
externalInHospPatientInfo.setRuYuanSJ(externalInDeptPatientInfo.getRuYuanSJ());
- externalInHospPatientInfo.setJingGuanYSID(externalInDeptPatientInfo.getJingGuanYSID());
- externalInHospPatientInfo.setJingGuanYSXM(externalInDeptPatientInfo.getJingGuanYSXM());
externalInHospPatientInfo.setLianXiDH(ObjectUtils.isNotEmpty(BingRenXX.get("LianXiDH")) ? BingRenXX.get("LianXiDH").toString() : null);
externalInHospPatientInfo.setDangQianCWID(ObjectUtils.isNotEmpty(BingRenXX.get("DangQianCWID")) ? BingRenXX.get("DangQianCWID").toString() : null);
externalInHospPatientInfo.setDangQianCWMC(ObjectUtils.isNotEmpty(BingRenXX.get("DangQianCWMC")) ? BingRenXX.get("DangQianCWMC").toString() : null);
@@ -509,13 +522,20 @@
Map yeWuXX = (Map) dataMap.get("YeWuXX");
Map<String, Object> BingRenXX = ObjectUtils.isNotEmpty(yeWuXX) ? (Map<String, Object>) yeWuXX.get("BingRenXX") : null;
Map<String, Object> ChuYuanJL = ObjectUtils.isNotEmpty(yeWuXX) ? (Map<String, Object>) yeWuXX.get("ChuYuanJL") : null;
+ Map<String, Object> JiuZhenXX = ObjectUtils.isNotEmpty(yeWuXX) ? (Map<String, Object>) yeWuXX.get("JiuZhenXX") : null;
List<HashMap<String, Object>> epai = ObjectUtils.isNotEmpty(BingRenXX) ? (List<HashMap<String, Object>>) BingRenXX.get("DiZhiXXList") : null;
List<HashMap<String, Object>> epli = ObjectUtils.isNotEmpty(yeWuXX) ? (List<HashMap<String, Object>>) yeWuXX.get("LianXiRList") : null;
Map<String, Object> SuiFangJH = ObjectUtils.isNotEmpty(ChuYuanJL) ? (Map<String, Object>) ChuYuanJL.get("SuiFangJH") : null;
-
ExternalInHospPatientInfo externalInHospPatientInfo = BeanUtil.mapToBean(BingRenXX, ExternalInHospPatientInfo.class, true);
ExternalInHospPatientAddrInfo externalInHospPatientAddrInfo = null;
ExternalInHospPatientLiaisonInfo externalInHospPatientLiaisonInfo = null;
+
+ //灏辫瘖淇℃伅
+ ExternalInDeptPatientInfo externalJZInfo = BeanUtil.mapToBean(JiuZhenXX, ExternalInDeptPatientInfo.class, true);
+ if(ObjectUtils.isNotEmpty(externalJZInfo)){
+ externalInHospPatientInfo.setJingGuanYSID(externalJZInfo.getJingGuanYSID());
+ externalInHospPatientInfo.setJingGuanYSXM(externalJZInfo.getJingGuanYSXM());
+ }
List<ExternalInHospPatientAddrInfo> epai2 = null;
//姝讳骸鏍囪
Boolean deathFlag = false;
@@ -574,7 +594,6 @@
String tagname = patMedInhospMapper.getTagnameBypatid(patMedInhosp1.getPatid());
patMedInhosp1.setTagname(tagname);
}
- Map<String, Object> JiuZhenXX = ObjectUtils.isNotEmpty(yeWuXX) ? (Map<String, Object>) yeWuXX.get("JiuZhenXX") : null;
PatMedInhosp patMedInhosp1 = new PatMedInhosp();
if (CollectionUtils.isNotEmpty(patMedInhospList)) patMedInhosp1 = patMedInhospList.get(0);
patMedInhosp1.setSchemestatus(2L);
@@ -591,6 +610,9 @@
patMedInhosp1.setNurseName(ObjectUtils.isNotEmpty(JiuZhenXX.get("ZeRenHSXM")) ? JiuZhenXX.get("ZeRenHSXM").toString() : null);
patMedInhosp1.setNurseId(ObjectUtils.isNotEmpty(JiuZhenXX.get("ZeRenHSID")) ? JiuZhenXX.get("ZeRenHSID").toString() : null);
patMedInhosp1.setBedNo(ObjectUtils.isNotEmpty(JiuZhenXX.get("DangQianCWMC")) ? JiuZhenXX.get("DangQianCWMC").toString() : null);
+
+ patMedInhosp1.setManagementDoctorCode(ObjectUtils.isNotEmpty(JiuZhenXX.get("JingGuanYSID")) ? JiuZhenXX.get("JingGuanYSID").toString() : null);
+ patMedInhosp1.setManagementDoctor(ObjectUtils.isNotEmpty(JiuZhenXX.get("JingGuanYSXM")) ? JiuZhenXX.get("JingGuanYSXM").toString() : null);
//绂婚櫌鏂瑰紡浠g爜 1-鍖荤灘绂婚櫌 2-鍖诲槺杞櫌 3-鍖诲槺杞ぞ鍖哄崼鐢熸湇鍔℃満鏋�/涔¢晣鍗敓闄�
// 4-闈炲尰鍢辩闄� 5-姝讳骸 9-鍏朵粬 10-浠嬪叆瀹� 20-鎵嬫湳瀹�
@@ -974,6 +996,9 @@
patMedInhosp1.setNurseName(ObjectUtils.isNotEmpty(JiuZhenXX.get("ZeRenHSXM")) ? JiuZhenXX.get("ZeRenHSXM").toString() : null);
patMedInhosp1.setNurseId(ObjectUtils.isNotEmpty(JiuZhenXX.get("ZeRenHSID")) ? JiuZhenXX.get("ZeRenHSID").toString() : null);
patMedInhosp1.setBedNo(ObjectUtils.isNotEmpty(JiuZhenXX.get("DangQianCWMC")) ? JiuZhenXX.get("DangQianCWMC").toString() : null);
+
+ patMedInhosp1.setManagementDoctorCode(ObjectUtils.isNotEmpty(JiuZhenXX.get("JingGuanYSID")) ? JiuZhenXX.get("JingGuanYSID").toString() : null);
+ patMedInhosp1.setManagementDoctor(ObjectUtils.isNotEmpty(JiuZhenXX.get("JingGuanYSXM")) ? JiuZhenXX.get("JingGuanYSXM").toString() : null);
}
patMedInhosp1.setUpdateTime(new Date());
patMedInhosp1.setTelcode(patArchive.getTelcode());
@@ -1042,6 +1067,13 @@
int i = patMedInhospMapper.insertPatMedInhosp(patMedInhosp1);
if (i != 1) return false;
}
+
+ //绂婚櫌鏂瑰紡浠g爜 1-鍖荤灘绂婚櫌 2-鍖诲槺杞櫌 3-鍖诲槺杞ぞ鍖哄崼鐢熸湇鍔℃満鏋�/涔¢晣鍗敓闄�
+ // 4-闈炲尰鍢辩闄� 5-姝讳骸 9-鍏朵粬 10-浠嬪叆瀹� 20-鎵嬫湳瀹�
+ String liYuanQxdm = ObjectUtils.isNotEmpty(JiuZhenXX.get("LiYuanQXDM")) ? JiuZhenXX.get("LiYuanQXDM").toString() : null;
+ if (ObjectUtils.isNotEmpty(liYuanQxdm) && ("5").equals(liYuanQxdm)) {
+ deathPatProcess(liYuanQxdm,patMedInhosp1);
+ }
return true;
}
@@ -1083,6 +1115,13 @@
} catch (ParseException e) {
e.printStackTrace();
}
+ }
+
+ //绂婚櫌鏂瑰紡浠g爜 1-鍖荤灘绂婚櫌 2-鍖诲槺杞櫌 3-鍖诲槺杞ぞ鍖哄崼鐢熸湇鍔℃満鏋�/涔¢晣鍗敓闄�
+ // 4-闈炲尰鍢辩闄� 5-姝讳骸 9-鍏朵粬 10-浠嬪叆瀹� 20-鎵嬫湳瀹�
+ String liYuanQxdm = ObjectUtils.isNotEmpty(JiuZhenXX.get("LiYuanQXDM")) ? JiuZhenXX.get("LiYuanQXDM").toString() : null;
+ if (ObjectUtils.isNotEmpty(liYuanQxdm) && ("5").equals(liYuanQxdm)) {
+ deathPatProcess(liYuanQxdm,patMedInhosp1);
}
return true;
} else {
@@ -1415,7 +1454,7 @@
Boolean addMianTableFalg = true;
for (ExternalOperationDetail externalOperationDetail : externalOperationDetails) {
PatMedOperationItem patMedOperationItem = new PatMedOperationItem();
- patMedOperationItem.setOpid(patMedOperation.getId());
+ patMedOperationItem.setOpid(patMedOperation.getOpid());
patMedOperationItem.setOpcode(externalOperationDetail.getShouShuMCID());
patMedOperationItem.setOpdesc(externalOperationDetail.getShouShuMC());
patMedOperationItem.setMainFlag(externalOperationDetail.getZhuShouSBZ());
@@ -1855,6 +1894,22 @@
return true;
}
+ @Override
+ public Map<String, Object> query360PatInfolwl(Long patid, SysUser sysUser) {
+ 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());
+ }
+ return map;
+ }
+
private Boolean getType(String type, Map dataMap) {
switch (type) {
case "BR_DA_DangAnJL":
@@ -2031,4 +2086,76 @@
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;
+ }
+
+ /**
+ * 姝讳骸鎮h�呭鐞�
+ * @param liYuanQxdm
+ * @param patMedInhosp
+ * @return
+ */
+ private int deathPatProcess(String liYuanQxdm, PatMedInhosp patMedInhosp){
+ //姝讳骸鏍囪
+ Boolean deathFlag = false;
+ //鍒ゆ柇鐥呬汉鏄惁姝讳骸
+ if (ObjectUtils.isNotEmpty(liYuanQxdm) && ("5").equals(liYuanQxdm)) {
+ deathFlag = true;
+ }
+ PatArchive patArchive = patArchiveMapper.selectPatArchiveByPatid(patMedInhosp.getPatid());
+ if(ObjectUtils.isNotEmpty(patArchive)) {
+ patMedInhosp.setInhospstate("1");
+ if (deathFlag) {
+ //鐥呬汉姝讳骸鏃犻』闅忚
+ patMedInhosp.setFuflag("0");
+ //鏇存柊鐥呬汉 notrequiredFlag
+ patArchive.setNotrequiredFlag("1");
+ patArchive.setNotrequiredreason("鎮h�呭凡绂讳笘");
+ patArchiveMapper.updatePatArchive(patArchive);
+ //瀵瑰凡缁忕敓鎴愮殑闅忚浠诲姟杩涜澶勭悊
+ ServiceSubtaskEntity serviceSubtaskVO = new ServiceSubtaskEntity();
+ serviceSubtaskVO.setPatid(patArchive.getId());
+ serviceSubtaskVO.setSendstate(2L);
+ List<ServiceSubtask> serviceSubtaskList = serviceSubtaskMapper.selectServiceSubtaskList(serviceSubtaskVO);
+ for (ServiceSubtask serviceSubtask : serviceSubtaskList) {
+ serviceSubtask.setSendstate(4L);
+ serviceSubtask.setRemark(serviceSubtask.getRemark() + ";鎮h�呭凡绂讳笘锛屼笉闅忚");
+ serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
+ }
+ } else {
+ return 0;
+ }
+ }else {
+ return -1;
+ }
+ return 1;
+ }
}
--
Gitblit v1.9.3