|
|
|
@ -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,30 @@ 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.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.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 +64,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; |
|
|
|
|
|
|
|
/** |
|
|
|
* 前端调用查询列表接口,如果有数据则直接返回 |
|
|
|
@ -85,13 +103,18 @@ 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 { |
|
|
|
PmsPatientVo.PatientList patientByCardNo = getPatientByCardNo(cardNo); |
|
|
|
@ -103,7 +126,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); |
|
|
|
} |
|
|
|
//查找到患者信息,先添加基本信息
|
|
|
|
@ -124,30 +147,31 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService { |
|
|
|
PmsPatientBodyExample patientBodyExample = new PmsPatientBodyExample(); |
|
|
|
patientBodyExample.createCriteria().andOutpatientNoEqualTo(cardNo).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()); |
|
|
|
if (CollUtil.isEmpty(pmsPatientBodies)) { |
|
|
|
Map<String, List<Map<String, Object>>> patientOtherMsgByCardNo = getPatientOtherMsgByCardNo(cardNo, patientByCardNo.getPatientId()); |
|
|
|
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)){ |
|
|
|
if (CollUtil.isNotEmpty(patientOtherMsgByCardNo)) { |
|
|
|
//不为空则添加其他信息
|
|
|
|
patientOtherMsgByCardNo.forEach((key, valueList) -> { |
|
|
|
if(CollUtil.isNotEmpty(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()); |
|
|
|
@ -210,10 +234,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); |
|
|
|
@ -243,7 +267,7 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService { |
|
|
|
try { |
|
|
|
gmxx = hisConnectionDao.getGmxx(cardNo); |
|
|
|
log.info("查询视图gmxx成功:{}", gmxx.get(0)); |
|
|
|
}catch (Exception e){ |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("查询视图gmxx异常", e); |
|
|
|
} |
|
|
|
//查视图病历信息
|
|
|
|
@ -251,7 +275,7 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService { |
|
|
|
try { |
|
|
|
blxx = hisConnectionDao.getBlxx(cardNo); |
|
|
|
log.info("查询视图blxx成功:{}", blxx.get(0)); |
|
|
|
}catch (Exception e){ |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("查询视图blxx异常", e); |
|
|
|
} |
|
|
|
|
|
|
|
@ -285,7 +309,7 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService { |
|
|
|
personal.put("allergyDrug", item.get("过敏信息")); |
|
|
|
} |
|
|
|
personalList.add(personal); |
|
|
|
if(CollUtil.isNotEmpty(personalList)){ |
|
|
|
if (CollUtil.isNotEmpty(personalList)) { |
|
|
|
result.put("pmsPatientPersonal", personalList); |
|
|
|
} |
|
|
|
|
|
|
|
@ -297,7 +321,7 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService { |
|
|
|
// 基本信息
|
|
|
|
bodyInfo.put("outpatientNo", cardNo); |
|
|
|
bodyInfo.put("patientId", patientId); |
|
|
|
if(ObjectUtil.isNotNull(zyData) && zyData != null){ |
|
|
|
if (ObjectUtil.isNotNull(zyData) && zyData != null) { |
|
|
|
bodyInfo.put("age", zyData.getStr("age")); |
|
|
|
bodyInfo.put("department", zyData.getStr("deptName")); |
|
|
|
bodyInfo.put("doctor", zyData.getStr("directorDocName")); |
|
|
|
@ -305,8 +329,8 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService { |
|
|
|
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("diagnosisType", "2"); |
|
|
|
bodyInfo.put("isMainDiagnosis", "1"); |
|
|
|
bodyInfo.put("diagnosisName", zyData.getStr("ryDiagnose")); |
|
|
|
bodyInfo.put("diagnosisCode", zyData.getStr("ryDiagnoseCode")); |
|
|
|
bodyInfo.put("diagnosisDate", zyData.getStr("inDate")); |
|
|
|
@ -315,11 +339,11 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService { |
|
|
|
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){ |
|
|
|
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){ |
|
|
|
} 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")); |
|
|
|
@ -337,7 +361,7 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService { |
|
|
|
bodyInfo.put("creatinine", item.get("肌酐")); |
|
|
|
} |
|
|
|
bodyList.add(bodyInfo); |
|
|
|
if(CollUtil.isNotEmpty(bodyList)){ |
|
|
|
if (CollUtil.isNotEmpty(bodyList)) { |
|
|
|
result.put("pmsPatientBody", bodyList); |
|
|
|
} |
|
|
|
|
|
|
|
@ -353,7 +377,6 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private JSONObject getApiData(HttpResponse response, String errorString) { |
|
|
|
JSONObject mzData = null; |
|
|
|
if (response.isOk()) { |
|
|
|
@ -367,7 +390,7 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService { |
|
|
|
return null; |
|
|
|
} |
|
|
|
mzData = dataArray; |
|
|
|
}catch (Exception e){ |
|
|
|
} catch (Exception e) { |
|
|
|
log.error(errorString + "接口-请求失败: {}", response.getStatus()); |
|
|
|
} |
|
|
|
} else { |
|
|
|
@ -411,7 +434,7 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService { |
|
|
|
Matcher matcher1 = pattern1.matcher(text); |
|
|
|
if (matcher1.find()) { |
|
|
|
String group = matcher1.group(1); |
|
|
|
if(StrUtil.isNotBlank(group)){ |
|
|
|
if (StrUtil.isNotBlank(group)) { |
|
|
|
result.put("smokingYear", group); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -419,7 +442,7 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService { |
|
|
|
int smokingQuit = text.contains("未戒烟") ? 0 : 1; |
|
|
|
result.put("smokingQuit", smokingQuit); |
|
|
|
|
|
|
|
if(smokingQuit == 1){ |
|
|
|
if (smokingQuit == 1) { |
|
|
|
Pattern pattern2 = Pattern.compile("已?戒(?:烟|酒)?\\s*(\\d+)\\s*(月|年)\\s*(?:余)?"); |
|
|
|
Matcher matcher2 = pattern2.matcher(text); |
|
|
|
if (matcher2.find()) { |
|
|
|
@ -452,7 +475,7 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService { |
|
|
|
Matcher matcher1 = pattern1.matcher(text); |
|
|
|
if (matcher1.find()) { |
|
|
|
String group = matcher1.group(1); |
|
|
|
if(StrUtil.isNotBlank(group)){ |
|
|
|
if (StrUtil.isNotBlank(group)) { |
|
|
|
result.put("drinkYear", group); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -460,7 +483,7 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService { |
|
|
|
int drinkQuit = text.contains("未戒酒") ? 0 : 1; |
|
|
|
result.put("drinkQuit", drinkQuit); |
|
|
|
|
|
|
|
if(drinkQuit == 1){ |
|
|
|
if (drinkQuit == 1) { |
|
|
|
Pattern pattern2 = Pattern.compile("已?戒(?:烟|酒)?\\s*(\\d+)\\s*(月|年)\\s*(?:余)?"); |
|
|
|
Matcher matcher2 = pattern2.matcher(text); |
|
|
|
if (matcher2.find()) { |
|
|
|
@ -479,4 +502,184 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService { |
|
|
|
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) { |
|
|
|
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查找部门信息
|
|
|
|
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) { |
|
|
|
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); |
|
|
|
sysUserMapper.insertUser(sysUser); |
|
|
|
} else { |
|
|
|
sysUser.setUserId(users.get(0).getUserId()); |
|
|
|
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; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|