|
|
|
@ -2,6 +2,8 @@ package com.ccsens.client.service.impl; |
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
import cn.hutool.core.date.DateField; |
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
import cn.hutool.core.io.FileUtil; |
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
@ -16,27 +18,28 @@ import com.ccsens.client.persist.dao.PmsPatientDao; |
|
|
|
import com.ccsens.client.service.ILtHisConnectionService; |
|
|
|
import com.ccsens.client.service.IPmsPatientService; |
|
|
|
import com.ccsens.common.annotation.DataSource; |
|
|
|
import com.ccsens.common.core.domain.entity.SysDept; |
|
|
|
import com.ccsens.common.core.domain.entity.SysRole; |
|
|
|
import com.ccsens.common.core.domain.entity.SysUser; |
|
|
|
import com.ccsens.common.core.domain.model.LoginUser; |
|
|
|
import com.ccsens.common.enums.DataSourceType; |
|
|
|
import com.ccsens.common.utils.IDGenerator; |
|
|
|
import com.ccsens.common.utils.SecurityUtils; |
|
|
|
import com.ccsens.framework.datasource.DynamicDataSourceContextHolder; |
|
|
|
import com.ccsens.system.domain.SysUserRole; |
|
|
|
import com.ccsens.system.domain.dto.PmsPatientDto; |
|
|
|
import com.ccsens.system.domain.po.PmsPatient; |
|
|
|
import com.ccsens.system.domain.po.PmsPatientBody; |
|
|
|
import com.ccsens.system.domain.po.PmsPatientBodyExample; |
|
|
|
import com.ccsens.system.domain.po.PmsPatientExample; |
|
|
|
import com.ccsens.system.domain.po.*; |
|
|
|
import com.ccsens.system.domain.vo.PmsPatientVo; |
|
|
|
import com.ccsens.system.persist.mapper.PmsPatientBodyMapper; |
|
|
|
import com.ccsens.system.persist.mapper.*; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.poi.ss.formula.functions.T; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Propagation; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.*; |
|
|
|
import java.util.regex.Matcher; |
|
|
|
import java.util.regex.Pattern; |
|
|
|
|
|
|
|
@ -59,6 +62,19 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService { |
|
|
|
private PmsPatientDao patientDao; |
|
|
|
@Resource |
|
|
|
private PmsPatientBodyMapper patientBodyMapper; |
|
|
|
@Resource |
|
|
|
private SysDeptMapper sysDeptMapper; |
|
|
|
@Resource |
|
|
|
private SysUserMapper sysUserMapper; |
|
|
|
@Resource |
|
|
|
private SysUserRoleMapper userRoleMapper; |
|
|
|
@Resource |
|
|
|
private SysRoleMapper sysRoleMapper; |
|
|
|
|
|
|
|
@Value("${hospitalId:}") |
|
|
|
private Long hospitalId; |
|
|
|
@Value("${generalPassword:}") |
|
|
|
private String generalPassword; |
|
|
|
|
|
|
|
/** |
|
|
|
* 前端调用查询列表接口,如果有数据则直接返回 |
|
|
|
@ -75,6 +91,7 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService { |
|
|
|
|
|
|
|
//【RP1.1.4S054】查询患者档案信息
|
|
|
|
private static final String URL_SUFFIX_RP_1_1_4 = "/patient-service/api/v1/patient/archives/get?cardNo="; |
|
|
|
//查询住院记录http://200.1.8.36:7801/roc/patient-service/api/v1/patient/getFinIprList
|
|
|
|
|
|
|
|
//【RP2.1.6S062】查询门诊患者挂号记录
|
|
|
|
private static final String URL_SUFFIX_RP_2_1_6 = "/patient-service/api/v1/register/patient/getFinOprRegList"; |
|
|
|
@ -85,15 +102,40 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService { |
|
|
|
//【RE2.1.5S234】新 获取病案首页基本信息
|
|
|
|
private static final String URL_SUFFIX_RE_2_1_5 = "/patient-service/api/v1/patient/getFinOprRegList?inPatientNo="; |
|
|
|
|
|
|
|
//【RC1.1.1S001】查询科室列表
|
|
|
|
private static final String URL_SUFFIX_RC_1_1_1 = "/curr-web/api/v1/common/dept/query"; |
|
|
|
|
|
|
|
//【RC1.1.3S003】查询人员列表
|
|
|
|
private static final String URL_SUFFIX_RC_1_1_3 = "/curr-web/api/v1/common/employee/query"; |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<PmsPatientVo.PatientList> queryHisPatient(String cardNo) { |
|
|
|
LoginUser loginUser = null; |
|
|
|
try { |
|
|
|
loginUser = getLoginUser(); |
|
|
|
}catch (Exception e){ |
|
|
|
} catch (Exception e) { |
|
|
|
} |
|
|
|
try { |
|
|
|
//先试用传入的值查询病例视图
|
|
|
|
String visitNo = cardNo; |
|
|
|
List<Map<String, Object>> blxx = new ArrayList<>(); |
|
|
|
try { |
|
|
|
blxx = hisConnectionDao.getBlxxByVisitNo(cardNo); |
|
|
|
log.info("查询视图blxx成功:{}", blxx.get(0)); |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("查询视图blxx异常", e); |
|
|
|
} |
|
|
|
|
|
|
|
DynamicDataSourceContextHolder.setDataSourceType(DataSourceType.SLAVE.name()); |
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(blxx)) { |
|
|
|
Map<String, Object> item = blxx.get(0); |
|
|
|
Object object = item.get("患者卡号"); |
|
|
|
if(ObjectUtil.isNotNull(object)){ |
|
|
|
cardNo = object.toString(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
PmsPatientVo.PatientList patientByCardNo = getPatientByCardNo(cardNo); |
|
|
|
if (ObjectUtil.isNotNull(patientByCardNo)) { |
|
|
|
//检查当前患者信息是否在系统内已存在
|
|
|
|
@ -103,7 +145,7 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService { |
|
|
|
List<PmsPatient> pmsPatients = patientDao.selectByExample(example); |
|
|
|
if (CollUtil.isEmpty(pmsPatients)) { |
|
|
|
pmsPatient = new PmsPatient(); |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
pmsPatient = pmsPatients.get(0); |
|
|
|
} |
|
|
|
//查找到患者信息,先添加基本信息
|
|
|
|
@ -114,6 +156,7 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService { |
|
|
|
pmsPatient.setNameFull(PinyinUtil.getPinyin(pmsPatient.getName(), "")); |
|
|
|
pmsPatient.setNameInitial(PinyinUtil.getFirstLetter(pmsPatient.getName(), "")); |
|
|
|
pmsPatient.setPatientNumber(cardNo); |
|
|
|
pmsPatient.setMobile(patientByCardNo.getPhone()); |
|
|
|
|
|
|
|
PmsPatientVo.PatientInfo pmsPatientVo = patientService.editPatient(pmsPatient); |
|
|
|
//保存id
|
|
|
|
@ -122,48 +165,53 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService { |
|
|
|
try { |
|
|
|
//根据就诊流水号查找当前患者是否有baby信息
|
|
|
|
PmsPatientBodyExample patientBodyExample = new PmsPatientBodyExample(); |
|
|
|
patientBodyExample.createCriteria().andOutpatientNoEqualTo(cardNo).andPatientIdEqualTo(patientByCardNo.getPatientId()).andDelFlagEqualTo((byte) 0); |
|
|
|
patientBodyExample.createCriteria().andOutpatientNoEqualTo(visitNo).andPatientIdEqualTo(patientByCardNo.getPatientId()).andDelFlagEqualTo((byte) 0); |
|
|
|
List<PmsPatientBody> pmsPatientBodies = patientBodyMapper.selectByExample(patientBodyExample); |
|
|
|
if(CollUtil.isEmpty(pmsPatientBodies)){ |
|
|
|
Map<String, List<Map<String, Object>>> patientOtherMsgByCardNo = getPatientOtherMsgByCardNo(cardNo,patientByCardNo.getPatientId()); |
|
|
|
addOtherMsg(patientOtherMsgByCardNo, patientByCardNo); |
|
|
|
if (CollUtil.isEmpty(pmsPatientBodies)) { |
|
|
|
Map<String, List<Map<String, Object>>> patientOtherMsgByCardNo = getPatientOtherMsgByCardNo(visitNo, cardNo, patientByCardNo.getPatientId()); |
|
|
|
// log.info("查询其他信息成功:{}", patientOtherMsgByCardNo);
|
|
|
|
// addOtherMsg(patientOtherMsgByCardNo, patientByCardNo);
|
|
|
|
} |
|
|
|
}catch (Exception e){ |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("获取患者其他信息失败", e); |
|
|
|
} |
|
|
|
List<PmsPatientVo.PatientList> list = new ArrayList<>(); |
|
|
|
list.add(patientByCardNo); |
|
|
|
return list; |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
return null; |
|
|
|
} |
|
|
|
}catch (Exception e){ |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("查询患者失败", e); |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public void addOtherMsg(Map<String, List<Map<String, Object>>> patientOtherMsgByCardNo, PmsPatientVo.PatientList patientByCardNo) { |
|
|
|
if(CollUtil.isNotEmpty(patientOtherMsgByCardNo)){ |
|
|
|
//不为空则添加其他信息
|
|
|
|
patientOtherMsgByCardNo.forEach((key, valueList) -> { |
|
|
|
if(CollUtil.isNotEmpty(valueList)){ |
|
|
|
valueList.forEach(value -> { |
|
|
|
com.alibaba.fastjson2.JSONObject valueJson = com.alibaba.fastjson2.JSONObject.parseObject(JSONUtil.toJsonStr(value)); |
|
|
|
valueJson.put("patientId", patientByCardNo.getPatientId()); |
|
|
|
PmsPatientDto.EditOtherMsg param = new PmsPatientDto.EditOtherMsg(); |
|
|
|
param.setEditType(key); |
|
|
|
param.setModel(valueJson); |
|
|
|
patientService.editPatientOtherMsgByHis(param); |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// public void addOtherMsg(Map<String, List<Map<String, Object>>> patientOtherMsgByCardNo, PmsPatientVo.PatientList patientByCardNo) {
|
|
|
|
// if (CollUtil.isNotEmpty(patientOtherMsgByCardNo)) {
|
|
|
|
// //不为空则添加其他信息
|
|
|
|
// patientOtherMsgByCardNo.forEach((key, valueList) -> {
|
|
|
|
// if (CollUtil.isNotEmpty(valueList)) {
|
|
|
|
// valueList.forEach(value -> {
|
|
|
|
// com.alibaba.fastjson2.JSONObject valueJson = com.alibaba.fastjson2.JSONObject.parseObject(JSONUtil.toJsonStr(value));
|
|
|
|
// valueJson.put("patientId", patientByCardNo.getPatientId());
|
|
|
|
// PmsPatientDto.EditOtherMsg param = new PmsPatientDto.EditOtherMsg();
|
|
|
|
// param.setEditType(key);
|
|
|
|
// param.setModel(valueJson);
|
|
|
|
// log.info("添加其他信息:{}--{}", key, value);
|
|
|
|
// patientService.editPatientOtherMsgByHis(param);
|
|
|
|
// });
|
|
|
|
// }
|
|
|
|
// });
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public PmsPatientVo.PatientList getPatientByCardNo(String cardNo) { |
|
|
|
|
|
|
|
|
|
|
|
PmsPatientVo.PatientList patientVo; |
|
|
|
//调用"【RP1.1.4S054】查询患者档案信息"接口
|
|
|
|
String url = URL_PREFIX + URL_SUFFIX_RP_1_1_4 + cardNo; |
|
|
|
@ -187,14 +235,14 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService { |
|
|
|
log.warn("查询患者档案信息接口返回data为空"); |
|
|
|
return null; |
|
|
|
} |
|
|
|
// 取第一个患者信息
|
|
|
|
// 患者信息
|
|
|
|
patientVo = new PmsPatientVo.PatientList(); |
|
|
|
patientVo.setPatientName(data.getStr("patientName")); |
|
|
|
String genderCode = data.getStr("genderCode"); |
|
|
|
//TODO 性别需要实际调用接口后确定
|
|
|
|
if ("1".equals(genderCode) || genderCode.contains("男")) { |
|
|
|
patientVo.setSex((byte) 0); |
|
|
|
} else if ("0".equals(genderCode) || genderCode.contains("女")) { |
|
|
|
} else if ("0".equals(genderCode) || genderCode.contains("女") || "2".equals(genderCode)) { |
|
|
|
patientVo.setSex((byte) 1); |
|
|
|
} |
|
|
|
patientVo.setBirthday(data.getStr("birthDate")); |
|
|
|
@ -210,10 +258,10 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService { |
|
|
|
patientVo.setIdCardEncrypt(data.getStr("idCardNumber")); |
|
|
|
patientVo.setAboBloodType(data.getStr("bloodCode")); |
|
|
|
//TODO 职业和婚姻状况待定
|
|
|
|
if(ObjectUtil.isNotNull(data.getStr("mari"))){ |
|
|
|
if (ObjectUtil.isNotNull(data.getStr("mari"))) { |
|
|
|
patientVo.setMaritalStatus(Byte.valueOf(data.getStr("mari"))); |
|
|
|
} |
|
|
|
if(ObjectUtil.isNotNull(data.getStr("profCode"))){ |
|
|
|
if (ObjectUtil.isNotNull(data.getStr("profCode"))) { |
|
|
|
patientVo.setCareer(Byte.valueOf(data.getStr("profCode"))); |
|
|
|
} |
|
|
|
log.info("处理后的patient信息: {}", patientVo); |
|
|
|
@ -225,7 +273,13 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService { |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Map<String, List<Map<String, Object>>> getPatientOtherMsgByCardNo(String cardNo, Long patientId) { |
|
|
|
public Map<String, List<Map<String, Object>>> getPatientOtherMsgByCardNo(String visitNo, String cardNo, Long patientId) { |
|
|
|
|
|
|
|
PmsPatientBody pmsPatientBody = new PmsPatientBody(); |
|
|
|
PmsPatientPersonal pmsPatientPersonal = new PmsPatientPersonal(); |
|
|
|
PmsPatientDiagnosis PmsPatientDiagnosis = new PmsPatientDiagnosis(); |
|
|
|
PmsPatientParentIllness pmsPatientParentIllness = new PmsPatientParentIllness(); |
|
|
|
|
|
|
|
//1.查询所有需要的信息
|
|
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
|
params.put("cardNo", cardNo); |
|
|
|
@ -241,17 +295,17 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService { |
|
|
|
//查视图过敏信息
|
|
|
|
List<Map<String, Object>> gmxx = new ArrayList<>(); |
|
|
|
try { |
|
|
|
gmxx = hisConnectionDao.getGmxx(cardNo); |
|
|
|
log.info("查询视图gmxx成功:{}", gmxx.get(0)); |
|
|
|
}catch (Exception e){ |
|
|
|
gmxx = hisConnectionDao.getGmxxByVisitNo(visitNo); |
|
|
|
log.info("查询视图gmxx成功:{}", gmxx); |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("查询视图gmxx异常", e); |
|
|
|
} |
|
|
|
//查视图病历信息
|
|
|
|
List<Map<String, Object>> blxx = new ArrayList<>(); |
|
|
|
try { |
|
|
|
blxx = hisConnectionDao.getBlxx(cardNo); |
|
|
|
log.info("查询视图blxx成功:{}", blxx.get(0)); |
|
|
|
}catch (Exception e){ |
|
|
|
blxx = hisConnectionDao.getBlxxByVisitNo(visitNo); |
|
|
|
log.info("查询视图blxx成功:{}", blxx); |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("查询视图blxx异常", e); |
|
|
|
} |
|
|
|
|
|
|
|
@ -260,34 +314,29 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService { |
|
|
|
// 病史信息 - PmsPatientPersonal
|
|
|
|
List<Map<String, Object>> personalList = new ArrayList<>(); |
|
|
|
Map<String, Object> personal = new HashMap<>(); |
|
|
|
personal.put("patientId", patientId); |
|
|
|
personal.put("visitNo", cardNo); |
|
|
|
// personal.put("patientId", patientId);
|
|
|
|
// personal.put("visitNo", visitNo);
|
|
|
|
pmsPatientPersonal.setPatientId(patientId); |
|
|
|
pmsPatientPersonal.setVisitNo(visitNo); |
|
|
|
if (CollUtil.isNotEmpty(blxx)) { |
|
|
|
Map<String, Object> item = blxx.get(0); |
|
|
|
log.info("视图blxx信息: {}", item); |
|
|
|
|
|
|
|
Map<String, Object> smokingMap = extractSmokingInfo((String) item.get("是否吸烟")); |
|
|
|
Map<String, Object> drinkMap = extractDrinkInfo((String) item.get("是否饮酒")); |
|
|
|
personal.putAll(smokingMap); |
|
|
|
personal.putAll(drinkMap); |
|
|
|
// personal.put("smokingHistory", item.get("是否吸烟"));
|
|
|
|
// personal.put("smokingYear", item.get("吸烟年限"));
|
|
|
|
// personal.put("smokingQuit", item.get("是否戒烟"));
|
|
|
|
// personal.put("smokingQuitYear", item.get("戒烟年限"));
|
|
|
|
// personal.put("drinkHistory", item.get("是否饮酒"));
|
|
|
|
// personal.put("drinkYear", item.get("饮酒年限"));
|
|
|
|
// personal.put("drinkQuit", item.get("是否戒酒"));
|
|
|
|
// personal.put("drinkQuitYear", item.get("戒酒年限"));
|
|
|
|
extractSmokingInfo((String) item.get("是否吸烟"),pmsPatientPersonal); |
|
|
|
extractDrinkInfo((String) item.get("是否饮酒"),pmsPatientPersonal); |
|
|
|
// personal.putAll(smokingMap);
|
|
|
|
// personal.putAll(drinkMap);
|
|
|
|
} |
|
|
|
// 过敏信息 - 也放入PmsPatientPersonal
|
|
|
|
if (CollUtil.isNotEmpty(gmxx)) { |
|
|
|
Map<String, Object> item = gmxx.get(0); |
|
|
|
personal.put("allergyDrug", item.get("过敏信息")); |
|
|
|
} |
|
|
|
personalList.add(personal); |
|
|
|
if(CollUtil.isNotEmpty(personalList)){ |
|
|
|
result.put("pmsPatientPersonal", personalList); |
|
|
|
// personal.put("allergyDrug", item.get("过敏信息"));
|
|
|
|
pmsPatientPersonal.setAllergyDrug((String) item.get("过敏信息")); |
|
|
|
} |
|
|
|
// personalList.add(personal);
|
|
|
|
// if (CollUtil.isNotEmpty(personalList)) {
|
|
|
|
// result.put("pmsPatientPersonal", personalList);
|
|
|
|
// }
|
|
|
|
|
|
|
|
//TODO "诊断用药(多个)对应数据库现病史 PmsPatientParentIllness" 暂无
|
|
|
|
|
|
|
|
@ -295,51 +344,86 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService { |
|
|
|
List<Map<String, Object>> bodyList = new ArrayList<>(); |
|
|
|
Map<String, Object> bodyInfo = new HashMap<>(); |
|
|
|
// 基本信息
|
|
|
|
bodyInfo.put("outpatientNo", cardNo); |
|
|
|
bodyInfo.put("patientId", patientId); |
|
|
|
if(ObjectUtil.isNotNull(zyData) && zyData != null){ |
|
|
|
bodyInfo.put("age", zyData.getStr("age")); |
|
|
|
bodyInfo.put("department", zyData.getStr("deptName")); |
|
|
|
bodyInfo.put("doctor", zyData.getStr("directorDocName")); |
|
|
|
bodyInfo.put("admissionDate", zyData.getStr("inDate")); |
|
|
|
bodyInfo.put("admissionCount", zyData.getStr("inTimes")); |
|
|
|
bodyInfo.put("bedNumber", zyData.getStr("bedNo")); |
|
|
|
bodyInfo.put("dischargeDate", zyData.getStr("outDate")); |
|
|
|
bodyInfo.put("diagnosisType","2"); |
|
|
|
bodyInfo.put("isMainDiagnosis","1"); |
|
|
|
bodyInfo.put("diagnosisName", zyData.getStr("ryDiagnose")); |
|
|
|
bodyInfo.put("diagnosisCode", zyData.getStr("ryDiagnoseCode")); |
|
|
|
bodyInfo.put("diagnosisDate", zyData.getStr("inDate")); |
|
|
|
// bodyInfo.put("outpatientNo", visitNo);
|
|
|
|
// bodyInfo.put("patientId", patientId);
|
|
|
|
pmsPatientBody.setOutpatientNo(visitNo); |
|
|
|
pmsPatientBody.setPatientId(patientId); |
|
|
|
if (ObjectUtil.isNotNull(zyData) && zyData != null) { |
|
|
|
// bodyInfo.put("age", zyData.getStr("age"));
|
|
|
|
// bodyInfo.put("department", zyData.getStr("deptName"));
|
|
|
|
// bodyInfo.put("doctor", zyData.getStr("directorDocName"));
|
|
|
|
// bodyInfo.put("admissionDate", zyData.getStr("inDate"));
|
|
|
|
// bodyInfo.put("admissionCount", zyData.getStr("inTimes"));
|
|
|
|
// bodyInfo.put("bedNumber", zyData.getStr("bedNo"));
|
|
|
|
// bodyInfo.put("dischargeDate", zyData.getStr("outDate"));
|
|
|
|
// bodyInfo.put("diagnosisType", "2");
|
|
|
|
// bodyInfo.put("isMainDiagnosis", "1");
|
|
|
|
// bodyInfo.put("diagnosisName", zyData.getStr("ryDiagnose"));
|
|
|
|
// bodyInfo.put("diagnosisCode", zyData.getStr("ryDiagnoseCode"));
|
|
|
|
// bodyInfo.put("diagnosisDate", zyData.getStr("inDate"));
|
|
|
|
pmsPatientBody.setAge(zyData.getStr("age")); |
|
|
|
pmsPatientBody.setDepartment(zyData.getStr("deptName")); |
|
|
|
pmsPatientBody.setDoctor(zyData.getStr("directorDocName")); |
|
|
|
pmsPatientBody.setAdmissionDate(zyData.getStr("inDate")); |
|
|
|
pmsPatientBody.setAdmissionCount(zyData.getStr("inTimes")); |
|
|
|
pmsPatientBody.setBedNumber(zyData.getStr("bedNo")); |
|
|
|
pmsPatientBody.setDischargeDate(zyData.getStr("outDate")); |
|
|
|
pmsPatientBody.setDiagnosisType("2"); |
|
|
|
pmsPatientBody.setIsMainDiagnosis("1"); |
|
|
|
pmsPatientBody.setDiagnosisName(zyData.getStr("ryDiagnose")); |
|
|
|
pmsPatientBody.setDiagnosisCode(zyData.getStr("ryDiagnoseCode")); |
|
|
|
pmsPatientBody.setDiagnosisDate(zyData.getStr("inDate")); |
|
|
|
|
|
|
|
|
|
|
|
//如果住院信息不为空,查病案首页信息
|
|
|
|
String baUrl = URL_PREFIX + URL_SUFFIX_RE_2_1_5 + zyData.getStr("inPatientNo"); |
|
|
|
HttpResponse baResponse = getHttpResponse(baUrl); |
|
|
|
JSONObject baData = getApiData(baResponse, "【RE2.1.5S234】新 获取病案首页基本信息"); |
|
|
|
if(ObjectUtil.isNotNull(baData) && baData != null){ |
|
|
|
bodyInfo.put("admissionMethod", baData.getStr("inWay")); |
|
|
|
bodyInfo.put("dischargeMethod", baData.getStr("outType")); |
|
|
|
} |
|
|
|
}else if(ObjectUtil.isNotNull(mzData) && mzData != null){ |
|
|
|
bodyInfo.put("age", mzData.getStr("age")); |
|
|
|
bodyInfo.put("department", mzData.getStr("deptName")); |
|
|
|
bodyInfo.put("doctor", mzData.getStr("docName")); |
|
|
|
bodyInfo.put("admissionDate", mzData.getStr("receptDate")); |
|
|
|
if (ObjectUtil.isNotNull(baData) && baData != null) { |
|
|
|
// bodyInfo.put("admissionMethod", baData.getStr("inWay"));
|
|
|
|
// bodyInfo.put("dischargeMethod", baData.getStr("outType"));
|
|
|
|
pmsPatientBody.setAdmissionMethod(baData.getStr("inWay")); |
|
|
|
pmsPatientBody.setDischargeMethod(baData.getStr("outType")); |
|
|
|
} |
|
|
|
} else if (ObjectUtil.isNotNull(mzData) && mzData != null) { |
|
|
|
// bodyInfo.put("age", mzData.getStr("age"));
|
|
|
|
// bodyInfo.put("department", mzData.getStr("deptName"));
|
|
|
|
// bodyInfo.put("doctor", mzData.getStr("docName"));
|
|
|
|
// bodyInfo.put("admissionDate", mzData.getStr("receptDate"));
|
|
|
|
pmsPatientBody.setAge(mzData.getStr("age")); |
|
|
|
pmsPatientBody.setDepartment(mzData.getStr("deptName")); |
|
|
|
pmsPatientBody.setDoctor(mzData.getStr("docName")); |
|
|
|
pmsPatientBody.setAdmissionDate(mzData.getStr("receptDate")); |
|
|
|
} |
|
|
|
if (CollUtil.isNotEmpty(blxx)) { |
|
|
|
Map<String, Object> item = blxx.get(0); |
|
|
|
bodyInfo.put("height", item.get("身高")); |
|
|
|
bodyInfo.put("weight", item.get("体重")); |
|
|
|
bodyInfo.put("temperature", item.get("体温")); |
|
|
|
//TODO 血压需要处理
|
|
|
|
bodyInfo.put("bloodPressureShrink", item.get("血压")); |
|
|
|
bodyInfo.put("bloodPressureDiastole", item.get("血压")); |
|
|
|
bodyInfo.put("pulse", item.get("脉搏")); |
|
|
|
bodyInfo.put("creatinine", item.get("肌酐")); |
|
|
|
} |
|
|
|
bodyList.add(bodyInfo); |
|
|
|
if(CollUtil.isNotEmpty(bodyList)){ |
|
|
|
result.put("pmsPatientBody", bodyList); |
|
|
|
} |
|
|
|
// bodyInfo.put("height", item.get("身高"));
|
|
|
|
// bodyInfo.put("weight", item.get("体重"));
|
|
|
|
// bodyInfo.put("temperature", item.get("体温"));
|
|
|
|
// //TODO 血压需要处理
|
|
|
|
// bodyInfo.put("bloodPressureShrink", item.get("血压"));
|
|
|
|
// bodyInfo.put("bloodPressureDiastole", item.get("血压"));
|
|
|
|
// bodyInfo.put("pulse", item.get("脉搏"));
|
|
|
|
// bodyInfo.put("creatinine", item.get("肌酐"));
|
|
|
|
pmsPatientBody.setHeight((String) item.get("身高")); |
|
|
|
pmsPatientBody.setWeight((String) item.get("体重")); |
|
|
|
pmsPatientBody.setTemperature((String) item.get("体温")); |
|
|
|
pmsPatientBody.setPulse((String) item.get("脉搏")); |
|
|
|
pmsPatientBody.setCreatinine((String) item.get("肌酐")); |
|
|
|
if(ObjectUtil.isNotNull(item.get("血压"))){ |
|
|
|
String s = (String) item.get("血压"); |
|
|
|
String[] split = s.split("/"); |
|
|
|
if(split.length >= 2){ |
|
|
|
pmsPatientBody.setBloodPressureShrink(split[0]); |
|
|
|
pmsPatientBody.setBloodPressureDiastole(split[1]); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
// bodyList.add(bodyInfo);
|
|
|
|
// if (CollUtil.isNotEmpty(bodyList)) {
|
|
|
|
// log.info("pmsPatientBody信息: {}", bodyInfo);
|
|
|
|
// result.put("pmsPatientBody", bodyList);
|
|
|
|
// }
|
|
|
|
|
|
|
|
//TODO 暂无 tz T值
|
|
|
|
// oxygenSaturation 血氧饱和度
|
|
|
|
@ -349,11 +433,15 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService { |
|
|
|
// hematocrit 凝血酶原时间
|
|
|
|
// dimer D-二聚体
|
|
|
|
|
|
|
|
log.info("pmsPatientBody信息: {}", pmsPatientBody); |
|
|
|
log.info("pmsPatientPersonal信息: {}", pmsPatientPersonal); |
|
|
|
log.info("pmsPatientDiagnosis信息: {}", PmsPatientDiagnosis); |
|
|
|
log.info("pmsPatientParentIllness信息: {}", pmsPatientParentIllness); |
|
|
|
patientService.editPatientOtherMsgByHis(pmsPatientBody, pmsPatientPersonal, PmsPatientDiagnosis, pmsPatientParentIllness); |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private JSONObject getApiData(HttpResponse response, String errorString) { |
|
|
|
JSONObject mzData = null; |
|
|
|
if (response.isOk()) { |
|
|
|
@ -367,7 +455,7 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService { |
|
|
|
return null; |
|
|
|
} |
|
|
|
mzData = dataArray; |
|
|
|
}catch (Exception e){ |
|
|
|
} catch (Exception e) { |
|
|
|
log.error(errorString + "接口-请求失败: {}", response.getStatus()); |
|
|
|
} |
|
|
|
} else { |
|
|
|
@ -397,12 +485,15 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService { |
|
|
|
.execute(); |
|
|
|
} |
|
|
|
|
|
|
|
public static Map<String, Object> extractSmokingInfo(String text) { |
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
|
|
|
|
public static void extractSmokingInfo(String text,PmsPatientPersonal pmsPatientPersonal) { |
|
|
|
// Map<String, Object> result = new HashMap<>();
|
|
|
|
if(StrUtil.isEmpty(text)){ |
|
|
|
return; |
|
|
|
} |
|
|
|
// 是否吸烟 - 先判断否定情况
|
|
|
|
int smokingHistory = (text.contains("否认吸烟史") || text.contains("无吸烟史")) ? 0 : 1; |
|
|
|
result.put("smokingHistory", smokingHistory); |
|
|
|
// result.put("smokingHistory", smokingHistory);
|
|
|
|
pmsPatientPersonal.setSmokingHistory((byte) smokingHistory); |
|
|
|
|
|
|
|
// 只有有吸烟史时才提取其他信息
|
|
|
|
if (smokingHistory == 1) { |
|
|
|
@ -411,15 +502,22 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService { |
|
|
|
Matcher matcher1 = pattern1.matcher(text); |
|
|
|
if (matcher1.find()) { |
|
|
|
String group = matcher1.group(1); |
|
|
|
if(StrUtil.isNotBlank(group)){ |
|
|
|
result.put("smokingYear", group); |
|
|
|
if (StrUtil.isNotBlank(group)) { |
|
|
|
// result.put("smokingYear", group);
|
|
|
|
try { |
|
|
|
pmsPatientPersonal.setSmokingYear(Integer.parseInt(group)); |
|
|
|
}catch (Exception e){ |
|
|
|
log.error("吸烟年龄解析异常"); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
//是否戒烟
|
|
|
|
int smokingQuit = text.contains("未戒烟") ? 0 : 1; |
|
|
|
result.put("smokingQuit", smokingQuit); |
|
|
|
// result.put("smokingQuit", smokingQuit);
|
|
|
|
pmsPatientPersonal.setSmokingQuit((byte) smokingQuit); |
|
|
|
|
|
|
|
if(smokingQuit == 1){ |
|
|
|
if (smokingQuit == 1) { |
|
|
|
Pattern pattern2 = Pattern.compile("已?戒(?:烟|酒)?\\s*(\\d+)\\s*(月|年)\\s*(?:余)?"); |
|
|
|
Matcher matcher2 = pattern2.matcher(text); |
|
|
|
if (matcher2.find()) { |
|
|
|
@ -427,23 +525,32 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService { |
|
|
|
String unit = matcher2.group(2); |
|
|
|
|
|
|
|
if ("月".equals(unit)) { |
|
|
|
result.put("smokingQuitYear", 1); |
|
|
|
// result.put("smokingQuitYear", 1);
|
|
|
|
pmsPatientPersonal.setSmokingQuitYear(1); |
|
|
|
} else { |
|
|
|
result.put("smokingQuitYear", number); |
|
|
|
// result.put("smokingQuitYear", number);
|
|
|
|
try { |
|
|
|
pmsPatientPersonal.setSmokingQuitYear(Integer.parseInt(number)); |
|
|
|
}catch (Exception e){ |
|
|
|
log.error("戒烟年龄解析异常"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
public static Map<String, Object> extractDrinkInfo(String text) { |
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
// return result;
|
|
|
|
} |
|
|
|
|
|
|
|
public static void extractDrinkInfo(String text,PmsPatientPersonal pmsPatientPersonal) { |
|
|
|
// Map<String, Object> result = new HashMap<>();
|
|
|
|
if(StrUtil.isEmpty(text)){ |
|
|
|
return; |
|
|
|
} |
|
|
|
// 是否吸烟 - 先判断否定情况
|
|
|
|
int drinkHistory = (text.contains("否认饮酒史") || text.contains("无饮酒史")) ? 0 : 1; |
|
|
|
result.put("drinkHistory", drinkHistory); |
|
|
|
// result.put("drinkHistory", drinkHistory);
|
|
|
|
pmsPatientPersonal.setDrinkHistory((byte) drinkHistory); |
|
|
|
|
|
|
|
// 只有有吸烟史时才提取其他信息
|
|
|
|
if (drinkHistory == 1) { |
|
|
|
@ -452,15 +559,21 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService { |
|
|
|
Matcher matcher1 = pattern1.matcher(text); |
|
|
|
if (matcher1.find()) { |
|
|
|
String group = matcher1.group(1); |
|
|
|
if(StrUtil.isNotBlank(group)){ |
|
|
|
result.put("drinkYear", group); |
|
|
|
if (StrUtil.isNotBlank(group)) { |
|
|
|
// result.put("drinkYear", group);
|
|
|
|
try { |
|
|
|
pmsPatientPersonal.setDrinkYear(Integer.parseInt(group)); |
|
|
|
}catch (Exception e){ |
|
|
|
log.error("饮酒年龄解析异常"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
//是否戒烟
|
|
|
|
int drinkQuit = text.contains("未戒酒") ? 0 : 1; |
|
|
|
result.put("drinkQuit", drinkQuit); |
|
|
|
// result.put("drinkQuit", drinkQuit);
|
|
|
|
pmsPatientPersonal.setDrinkQuit((byte) drinkQuit); |
|
|
|
|
|
|
|
if(drinkQuit == 1){ |
|
|
|
if (drinkQuit == 1) { |
|
|
|
Pattern pattern2 = Pattern.compile("已?戒(?:烟|酒)?\\s*(\\d+)\\s*(月|年)\\s*(?:余)?"); |
|
|
|
Matcher matcher2 = pattern2.matcher(text); |
|
|
|
if (matcher2.find()) { |
|
|
|
@ -468,15 +581,216 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService { |
|
|
|
String unit = matcher2.group(2); |
|
|
|
|
|
|
|
if ("月".equals(unit)) { |
|
|
|
result.put("drinkQuitYear", 1); |
|
|
|
// result.put("drinkQuitYear", 1);
|
|
|
|
pmsPatientPersonal.setDrinkQuitYear(1); |
|
|
|
} else { |
|
|
|
result.put("drinkQuitYear", number); |
|
|
|
// result.put("drinkQuitYear", number);
|
|
|
|
try { |
|
|
|
pmsPatientPersonal.setDrinkQuitYear(Integer.parseInt(number)); |
|
|
|
}catch (Exception e){ |
|
|
|
log.error("饮酒年龄解析异常"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return result; |
|
|
|
// return result;
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public List<SysDept> syncDeptDataSlave() { |
|
|
|
List<SysDept> returnDepts = new ArrayList<>(); |
|
|
|
//查找部门信息
|
|
|
|
JSONArray deptData = queryDept(); |
|
|
|
//循环处理部门信息
|
|
|
|
for (int i = 0; i < deptData.size(); i++) { |
|
|
|
JSONObject dept = deptData.getJSONObject(i); |
|
|
|
SysDept sysDept = new SysDept(); |
|
|
|
sysDept.setDeptCode(dept.getStr("deptCode")); |
|
|
|
List<SysDept> sysDepts = sysDeptMapper.selectDeptList(sysDept); |
|
|
|
if (CollUtil.isEmpty(sysDepts)) { |
|
|
|
sysDept.setParentId(hospitalId); |
|
|
|
sysDept.setAncestors("0," + hospitalId); |
|
|
|
sysDept.setDeptName(dept.getStr("deptName")); |
|
|
|
sysDept.setDeptCode(dept.getStr("deptCode")); |
|
|
|
sysDeptMapper.insertDept(sysDept); |
|
|
|
returnDepts.add(sysDept); |
|
|
|
} else { |
|
|
|
sysDept = sysDepts.get(0); |
|
|
|
sysDept.setParentId(hospitalId); |
|
|
|
sysDept.setAncestors("0," + hospitalId); |
|
|
|
sysDept.setDeptName(dept.getStr("deptName")); |
|
|
|
sysDept.setDeptCode(dept.getStr("deptCode")); |
|
|
|
sysDeptMapper.updateDept(sysDept); |
|
|
|
returnDepts.add(sysDept); |
|
|
|
} |
|
|
|
} |
|
|
|
return returnDepts; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@DataSource(value = DataSourceType.MASTER) |
|
|
|
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class) |
|
|
|
public void syncDeptDataMaster(List<SysDept> sysDepts) { |
|
|
|
log.info("同步Master部门数据--{}--{}", sysDepts.size(), sysDepts.get(0)); |
|
|
|
if (CollUtil.isNotEmpty(sysDepts)) { |
|
|
|
sysDepts.forEach(sysDept -> { |
|
|
|
//根据code查找系统的部门信息
|
|
|
|
SysDept dept = new SysDept(); |
|
|
|
dept.setDeptCode(sysDept.getDeptCode()); |
|
|
|
List<SysDept> depts = sysDeptMapper.selectDeptList(dept); |
|
|
|
if (CollUtil.isEmpty(depts)) { |
|
|
|
sysDeptMapper.insertDept(sysDept); |
|
|
|
} else { |
|
|
|
SysDept sysDept1 = depts.get(0); |
|
|
|
sysDept.setDeptId(sysDept1.getDeptId()); |
|
|
|
sysDeptMapper.updateDept(sysDept); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<SysUser> syncUserDataSlave() { |
|
|
|
List<SysUser> returnUsers = new ArrayList<>(); |
|
|
|
//查询用户信息
|
|
|
|
JSONArray userData = queryUser(); |
|
|
|
//柳铁暂不处理部门权限,所有用户都是医院下,也不处理角色权限,所有都是测评师
|
|
|
|
//查询测评师角色
|
|
|
|
SysRole role = sysRoleMapper.queryRoleByRoleKey("yy_cps"); |
|
|
|
for (int i = 0; i < userData.size(); i++) { |
|
|
|
JSONObject user = userData.getJSONObject(i); |
|
|
|
//根据code查找部门信息
|
|
|
|
//
|
|
|
|
// Map<String, Object> userMap = new HashMap<>();
|
|
|
|
// userMap.put("deptCode", "lnb");
|
|
|
|
// userMap.put("emplCode", "admin");
|
|
|
|
// userMap.put("emplName", "adminName");
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// JSONObject user = JSONUtil.parseObj(userMap);
|
|
|
|
|
|
|
|
|
|
|
|
SysDept sysDept = new SysDept(); |
|
|
|
sysDept.setDeptCode(user.getStr("deptCode")); |
|
|
|
List<SysDept> sysDepts = sysDeptMapper.selectDeptList(sysDept); |
|
|
|
if (CollUtil.isEmpty(sysDepts)) { |
|
|
|
continue; |
|
|
|
} else { |
|
|
|
sysDept = sysDepts.get(0); |
|
|
|
} |
|
|
|
SysUser sysUser = new SysUser(); |
|
|
|
sysUser.setEmplCode(user.getStr("emplCode")); |
|
|
|
List<SysUser> sysUsers = sysUserMapper.selectUserList(sysUser); |
|
|
|
if (CollUtil.isEmpty(sysUsers)) { |
|
|
|
sysUser.setDeptId(sysDept.getDeptId()); |
|
|
|
sysUser.setUserName("u_" + user.getStr("emplCode")); |
|
|
|
sysUser.setNickName(user.getStr("emplName")); |
|
|
|
sysUser.setEmplCode(user.getStr("emplCode")); |
|
|
|
sysUser.setPassword(SecurityUtils.encryptPassword(generalPassword)); |
|
|
|
//获取一年后的日期
|
|
|
|
sysUser.setValidDate(DateUtil.offset(new Date(), DateField.YEAR, 1)); |
|
|
|
sysUserMapper.insertUser(sysUser); |
|
|
|
// 新增用户与角色管理
|
|
|
|
if (role != null) { |
|
|
|
SysUserRole ur = new SysUserRole(); |
|
|
|
ur.setUserId(sysUser.getUserId()); |
|
|
|
ur.setRoleId(role.getRoleId()); |
|
|
|
userRoleMapper.batchUserRole(CollUtil.newArrayList(ur)); |
|
|
|
} |
|
|
|
returnUsers.add(sysUser); |
|
|
|
} else { |
|
|
|
SysUser u = sysUsers.get(0); |
|
|
|
u.setDeptId(sysDept.getDeptId()); |
|
|
|
u.setNickName(user.getStr("emplName")); |
|
|
|
sysUserMapper.updateUser(u); |
|
|
|
returnUsers.add(u); |
|
|
|
} |
|
|
|
} |
|
|
|
return returnUsers; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@DataSource(value = DataSourceType.MASTER) |
|
|
|
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class) |
|
|
|
public void syncUserDataMaster(List<SysUser> sysUsers) { |
|
|
|
log.info("同步Master用户数据--{}--{}", sysUsers.size(), sysUsers.get(0)); |
|
|
|
if (CollUtil.isNotEmpty(sysUsers)) { |
|
|
|
for (SysUser sysUser : sysUsers) { |
|
|
|
//根据code查找用户
|
|
|
|
SysUser user = new SysUser(); |
|
|
|
user.setEmplCode(sysUser.getEmplCode()); |
|
|
|
List<SysUser> users = sysUserMapper.selectUserList(user); |
|
|
|
if (CollUtil.isEmpty(users)) { |
|
|
|
sysUser.setDeptId(hospitalId); |
|
|
|
sysUser.setPassword(SecurityUtils.encryptPassword(generalPassword)); |
|
|
|
log.info("master新增用户:{}", sysUser); |
|
|
|
sysUserMapper.insertUser(sysUser); |
|
|
|
} else { |
|
|
|
sysUser.setUserId(users.get(0).getUserId()); |
|
|
|
log.info("master更新用户:{}", sysUser); |
|
|
|
sysUserMapper.updateUser(sysUser); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private JSONArray queryUser() { |
|
|
|
//调用接口查询用户数据
|
|
|
|
String url = URL_PREFIX + URL_SUFFIX_RC_1_1_3; |
|
|
|
HttpResponse response = getHttpResponse(url); |
|
|
|
String userBody; |
|
|
|
if (response.isOk()) { |
|
|
|
userBody = response.body(); |
|
|
|
} else { |
|
|
|
log.error("【RP1.1.3】查询用户数据接口-请求失败: {}", response.getStatus()); |
|
|
|
return null; |
|
|
|
} |
|
|
|
try { |
|
|
|
JSONObject json = JSONUtil.parseObj(userBody); |
|
|
|
log.info("【RP1.1.3】查询用户数据接口-返回数据: {}", json); |
|
|
|
JSONArray dataArray = json.getJSONArray("data"); |
|
|
|
if (CollUtil.isEmpty(dataArray)) { |
|
|
|
log.warn("查询用户数据接口返回data为空"); |
|
|
|
return null; |
|
|
|
} |
|
|
|
return dataArray; |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("【RP1.1.3】查询用户数据接口-解析数据失败: {}", e.getMessage()); |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private JSONArray queryDept() { |
|
|
|
//调用接口查询部门数据
|
|
|
|
String url = URL_PREFIX + URL_SUFFIX_RC_1_1_1; |
|
|
|
HttpResponse response = getHttpResponse(url); |
|
|
|
String deptBody; |
|
|
|
|
|
|
|
if (response.isOk()) { |
|
|
|
deptBody = response.body(); |
|
|
|
} else { |
|
|
|
log.error("【RP1.1.1】查询部门数据接口-请求失败: {}", response.getStatus()); |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
try { |
|
|
|
JSONObject json = JSONUtil.parseObj(deptBody); |
|
|
|
log.info("【RP1.1.1】查询部门数据接口-返回数据: {}", json); |
|
|
|
|
|
|
|
// 获取data数组(这里应该是JSONArray,不是JSONObject)
|
|
|
|
JSONArray dataArray = json.getJSONArray("data"); |
|
|
|
|
|
|
|
if (CollUtil.isEmpty(dataArray)) { |
|
|
|
log.warn("查询部门数据接口返回data为空"); |
|
|
|
return null; |
|
|
|
} |
|
|
|
return dataArray; |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("查询部门信息异常", e); |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|