|
|
|
@ -36,10 +36,7 @@ import org.springframework.transaction.annotation.Propagation; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
|
@ -322,6 +319,7 @@ public class DockServiceImpl implements DockService { |
|
|
|
@DataSource(value = DataSourceType.MASTER) |
|
|
|
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class) |
|
|
|
public void syncUmsUserMaster(List<SysUser> sysUsers) { |
|
|
|
log.info("master开始同步用户数据:{}", sysUsers.size()); |
|
|
|
if (CollUtil.isNotEmpty(sysUsers)) { |
|
|
|
for (SysUser sysUser : sysUsers) { |
|
|
|
//根据code查找用户
|
|
|
|
@ -330,9 +328,12 @@ public class DockServiceImpl implements DockService { |
|
|
|
List<SysUser> users = sysUserMapper.selectUserList(user); |
|
|
|
if (CollUtil.isEmpty(users)) { |
|
|
|
sysUser.setDeptId(hospitalId); |
|
|
|
sysUser.setPassword(SecurityUtils.encryptPassword(user.getEmplCode() + generalPassword)); |
|
|
|
log.info("master新增用户信息:{}", sysUser); |
|
|
|
sysUserMapper.insertUser(sysUser); |
|
|
|
}else { |
|
|
|
sysUser.setUserId(users.get(0).getUserId()); |
|
|
|
log.info("master更新用户信息:{}", sysUser); |
|
|
|
sysUserMapper.updateUser(sysUser); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -389,7 +390,7 @@ public class DockServiceImpl implements DockService { |
|
|
|
sysUser.setUserName("u_" + dockEmpl.getEmplCode()); |
|
|
|
sysUser.setNickName(dockEmpl.getEmplName()); |
|
|
|
sysUser.setEmplCode(dockEmpl.getEmplCode()); |
|
|
|
sysUser.setPassword(SecurityUtils.encryptPassword(generalPassword)); |
|
|
|
sysUser.setPassword(SecurityUtils.encryptPassword(dockEmpl.getEmplCode() + generalPassword)); |
|
|
|
//获取一年后的日期
|
|
|
|
sysUser.setValidDate(DateUtil.offset(new Date(), DateField.YEAR, 1)); |
|
|
|
sysUser.setDataPower(dataPower); |
|
|
|
@ -470,6 +471,7 @@ public class DockServiceImpl implements DockService { |
|
|
|
@DataSource(value = DataSourceType.MASTER) |
|
|
|
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class) |
|
|
|
public void syncUmsDeptMaster(List<SysDept> sysDepts) { |
|
|
|
log.info("MASTER同步部门数据开始:{}",sysDepts.size()); |
|
|
|
if (CollUtil.isNotEmpty(sysDepts)) { |
|
|
|
sysDepts.forEach(sysDept -> { |
|
|
|
//根据code查找系统的部门信息
|
|
|
|
@ -477,10 +479,12 @@ public class DockServiceImpl implements DockService { |
|
|
|
dept.setDeptCode(sysDept.getDeptCode()); |
|
|
|
List<SysDept> depts = sysDeptMapper.selectDeptList(dept); |
|
|
|
if (CollUtil.isEmpty(depts)) { |
|
|
|
log.info("MASTER新增部门:{}",sysDept); |
|
|
|
sysDeptMapper.insertDept(sysDept); |
|
|
|
} else { |
|
|
|
SysDept sysDept1 = depts.get(0); |
|
|
|
sysDept.setDeptId(sysDept1.getDeptId()); |
|
|
|
log.info("MASTER更新部门:{}",sysDept); |
|
|
|
sysDeptMapper.updateDept(sysDept); |
|
|
|
} |
|
|
|
}); |
|
|
|
@ -512,7 +516,7 @@ public class DockServiceImpl implements DockService { |
|
|
|
pmsPatient = pmsPatients.get(0); |
|
|
|
disposePmsPatient(dockPatientBaseInfo, pmsPatient); |
|
|
|
pmsPatient.setHospitalId(hospitalId); |
|
|
|
pmsPatient.setUserId(CollUtil.isEmpty(sysUserList) ? null : sysUserList.get(0).getUserId()); |
|
|
|
pmsPatient.setCreateBy(CollUtil.isEmpty(sysUserList) ? null : sysUserList.get(0).getUserName()); |
|
|
|
pmsPatientMapper.updateByPrimaryKeySelective(pmsPatient); |
|
|
|
} else { |
|
|
|
//不存在则插入
|
|
|
|
@ -520,7 +524,7 @@ public class DockServiceImpl implements DockService { |
|
|
|
pmsPatient.setId(IdUtil.getSnowflake().nextId()); |
|
|
|
disposePmsPatient(dockPatientBaseInfo, pmsPatient); |
|
|
|
pmsPatient.setHospitalId(hospitalId); |
|
|
|
pmsPatient.setUserId(CollUtil.isEmpty(sysUserList) ? null : sysUserList.get(0).getUserId()); |
|
|
|
pmsPatient.setCreateBy(CollUtil.isEmpty(sysUserList) ? null : sysUserList.get(0).getUserName()); |
|
|
|
pmsPatientMapper.insertSelective(pmsPatient); |
|
|
|
} |
|
|
|
//修改同步表数据的状态
|
|
|
|
@ -549,26 +553,34 @@ public class DockServiceImpl implements DockService { |
|
|
|
//根据医生和部门信息查找业务表内对应的医生账号和部门id
|
|
|
|
String doctorName = ""; |
|
|
|
Long deptId = null; |
|
|
|
String deptName = ""; |
|
|
|
//医生用户名
|
|
|
|
String doctor = dockPatientVisitInfo.getDoctor(); |
|
|
|
if (StrUtil.isNotEmpty(doctor)) { |
|
|
|
String[] split = doctor.split("/"); |
|
|
|
if (split.length > 1) { |
|
|
|
SysUser sysUser = new SysUser(); |
|
|
|
sysUser.setEmplCode(split[1]); |
|
|
|
List<SysUser> sysUsers = sysUserMapper.selectUserList(sysUser); |
|
|
|
if (CollUtil.isNotEmpty(sysUsers)) { |
|
|
|
doctorName = sysUsers.get(0).getUserName(); |
|
|
|
} |
|
|
|
SysUser sysUser = new SysUser(); |
|
|
|
sysUser.setEmplCode(doctor); |
|
|
|
List<SysUser> sysUsers = sysUserMapper.selectUserList(sysUser); |
|
|
|
if (CollUtil.isNotEmpty(sysUsers)) { |
|
|
|
doctorName = sysUsers.get(0).getUserName(); |
|
|
|
} |
|
|
|
|
|
|
|
// String[] split = doctor.split("/");
|
|
|
|
// if (split.length > 1) {
|
|
|
|
// SysUser sysUser = new SysUser();
|
|
|
|
// sysUser.setEmplCode(split[1]);
|
|
|
|
// List<SysUser> sysUsers = sysUserMapper.selectUserList(sysUser);
|
|
|
|
// if (CollUtil.isNotEmpty(sysUsers)) {
|
|
|
|
// doctorName = sysUsers.get(0).getUserName();
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
} |
|
|
|
//部门id
|
|
|
|
if (StrUtil.isNotEmpty(dockPatientVisitInfo.getDepartment())) { |
|
|
|
SysDept sysDept = new SysDept(); |
|
|
|
sysDept.setDeptName(dockPatientVisitInfo.getDepartment()); |
|
|
|
sysDept.setDeptCode(dockPatientVisitInfo.getDepartment()); |
|
|
|
List<SysDept> sysDepts = sysDeptMapper.selectDeptList(sysDept); |
|
|
|
if (CollUtil.isNotEmpty(sysDepts)) { |
|
|
|
deptId = sysDepts.get(0).getDeptId(); |
|
|
|
deptName = sysDepts.get(0).getDeptName(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -588,7 +600,7 @@ public class DockServiceImpl implements DockService { |
|
|
|
pmsPatient.setId(IdUtil.getSnowflake().nextId()); |
|
|
|
disposePmsPatient(dockPatientBaseInfos.get(0), pmsPatient); |
|
|
|
//更新患者所属的部门和创建者信息,暂不考虑其他,每次都更新
|
|
|
|
pmsPatient.setHospitalId(ObjectUtil.isNull(deptId) ? hospitalId : deptId); |
|
|
|
pmsPatient.setHospitalId(hospitalId); |
|
|
|
if (StrUtil.isNotEmpty(doctorName)) { |
|
|
|
pmsPatient.setCreateBy(doctorName); |
|
|
|
} |
|
|
|
@ -600,7 +612,7 @@ public class DockServiceImpl implements DockService { |
|
|
|
} else { |
|
|
|
pmsPatient = pmsPatients.get(0); |
|
|
|
//更新患者所属的部门和创建者信息,暂不考虑其他,每次都更新
|
|
|
|
pmsPatient.setHospitalId(ObjectUtil.isNull(deptId) ? hospitalId : deptId); |
|
|
|
pmsPatient.setHospitalId(hospitalId); |
|
|
|
if (StrUtil.isNotEmpty(doctorName)) { |
|
|
|
pmsPatient.setCreateBy(doctorName); |
|
|
|
} |
|
|
|
@ -615,12 +627,14 @@ public class DockServiceImpl implements DockService { |
|
|
|
pmsPatientBody = pmsPatientBodies.get(0); |
|
|
|
pmsPatientBody.setPatientId(pmsPatient.getId()); |
|
|
|
disposePmsPatientBody(dockPatientVisitInfo, pmsPatientBody); |
|
|
|
pmsPatientBody.setDepartment(deptName); |
|
|
|
pmsPatientBodyMapper.updateByPrimaryKeySelective(pmsPatientBody); |
|
|
|
} else { |
|
|
|
pmsPatientBody = new PmsPatientBody(); |
|
|
|
pmsPatientBody.setId(IdUtil.getSnowflake().nextId()); |
|
|
|
pmsPatientBody.setPatientId(pmsPatient.getId()); |
|
|
|
disposePmsPatientBody(dockPatientVisitInfo, pmsPatientBody); |
|
|
|
pmsPatientBody.setDepartment(deptName); |
|
|
|
pmsPatientBodyMapper.insertSelective(pmsPatientBody); |
|
|
|
} |
|
|
|
return pmsPatientBody; |
|
|
|
@ -925,17 +939,20 @@ public class DockServiceImpl implements DockService { |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<DockVo.DeptInfo> getDeptView() { |
|
|
|
// 当前时间
|
|
|
|
Date endTime = new Date(); |
|
|
|
// 一小时前的时间
|
|
|
|
Date startTime = new Date(System.currentTimeMillis() - 60 * 60 * 1000); |
|
|
|
return oracleViewDao.getDeptView(startTime, endTime); |
|
|
|
return oracleViewDao.getDeptView(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void syncDeptView(List<DockVo.DeptInfo> sysDepts) { |
|
|
|
if(CollUtil.isNotEmpty(sysDepts)){ |
|
|
|
for (DockVo.DeptInfo sysDept : sysDepts) { |
|
|
|
//根据code和名称查询部门是否存在
|
|
|
|
DockDeptExample example = new DockDeptExample(); |
|
|
|
example.createCriteria().andDeptCodeEqualTo(sysDept.getDeptCode()).andDeptNameEqualTo(sysDept.getDeptName()); |
|
|
|
long l = dockDeptMapper.countByExample(example); |
|
|
|
if(l>0){ |
|
|
|
continue; |
|
|
|
} |
|
|
|
DockDept dockDept = new DockDept(); |
|
|
|
dockDept.setDeptName(sysDept.getDeptName()); |
|
|
|
dockDept.setDeptCode(sysDept.getDeptCode()); |
|
|
|
@ -947,16 +964,22 @@ public class DockServiceImpl implements DockService { |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<DockVo.EmplInfo> getEmplView() { |
|
|
|
Date endTime = new Date(); |
|
|
|
Date startTime = new Date(System.currentTimeMillis() - 60 * 60 * 1000); |
|
|
|
return oracleViewDao.getEmplView(startTime, endTime); |
|
|
|
return oracleViewDao.getEmplView(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void syncEmplView(List<DockVo.EmplInfo> sysEmpls) { |
|
|
|
if(CollUtil.isNotEmpty(sysEmpls)){ |
|
|
|
for (DockVo.EmplInfo sysEmpl : sysEmpls) { |
|
|
|
//根据工号查询员工是否存在
|
|
|
|
DockEmplExample example = new DockEmplExample(); |
|
|
|
example.createCriteria().andEmplCodeEqualTo(sysEmpl.getEmplCode()); |
|
|
|
long l = dockEmplMapper.countByExample(example); |
|
|
|
if(l>0){ |
|
|
|
continue; |
|
|
|
} |
|
|
|
DockEmpl dockEmpl = new DockEmpl(); |
|
|
|
dockEmpl.setId(Long.valueOf(sysEmpl.getId())); |
|
|
|
dockEmpl.setEmplName(sysEmpl.getEmplName()); |
|
|
|
dockEmpl.setEmplCode(sysEmpl.getEmplCode()); |
|
|
|
dockEmpl.setEmplType(sysEmpl.getEmplType()); |
|
|
|
@ -970,54 +993,38 @@ public class DockServiceImpl implements DockService { |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<DockVo.PatientBasicInfo> getPatientBasicView() { |
|
|
|
public List<DockVo.PatientVisitInfo> getPatientVisitView(Date startTime) { |
|
|
|
Date endTime = new Date(); |
|
|
|
Date startTime = new Date(System.currentTimeMillis() - 60 * 60 * 1000); |
|
|
|
return oracleViewDao.getPatientBasicView(startTime, endTime); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void syncPatientBasicView(List<DockVo.PatientBasicInfo> sysPatients) { |
|
|
|
if(CollUtil.isNotEmpty(sysPatients)){ |
|
|
|
for (DockVo.PatientBasicInfo sysPatient : sysPatients) { |
|
|
|
DockPatientBaseInfo dockPatientBase = new DockPatientBaseInfo(); |
|
|
|
dockPatientBase.setName(sysPatient.getName()); |
|
|
|
dockPatientBase.setPatientNo(sysPatient.getPatientNo()); |
|
|
|
dockPatientBase.setIdCard(sysPatient.getIdCard()); |
|
|
|
dockPatientBase.setPhone(sysPatient.getPhone()); |
|
|
|
dockPatientBase.setSex(sysPatient.getSex()); |
|
|
|
dockPatientBase.setBirthday(sysPatient.getBirthday()); |
|
|
|
dockPatientBase.setEducationalStatus(sysPatient.getEducationalStatus()); |
|
|
|
dockPatientBase.setCareer(sysPatient.getCareer()); |
|
|
|
dockPatientBase.setMaritalStatus(sysPatient.getMaritalStatus()); |
|
|
|
dockPatientBase.setNation(sysPatient.getNation()); |
|
|
|
dockPatientBase.setNativePlace(sysPatient.getNativePlace()); |
|
|
|
dockPatientBase.setAddress(sysPatient.getAddress()); |
|
|
|
dockPatientBase.setDwellingState(sysPatient.getDwellingState()); |
|
|
|
dockPatientBase.setContactName(sysPatient.getContactName()); |
|
|
|
dockPatientBase.setContactMobile(sysPatient.getContactMobile()); |
|
|
|
dockPatientBase.setContactRelation(sysPatient.getContactRelation()); |
|
|
|
dockPatientBase.setAboBloodType(sysPatient.getAboBloodType()); |
|
|
|
dockPatientBase.setRhBloodType(sysPatient.getRhBloodType()); |
|
|
|
dockPatientBase.setBelief(sysPatient.getBelief()); |
|
|
|
dockPatientBase.setHobby(sysPatient.getHobby()); |
|
|
|
dockPatientBase.setSync(String.valueOf(0)); |
|
|
|
dockPatientBaseInfoMapper.insertSelective(dockPatientBase); |
|
|
|
} |
|
|
|
if(ObjectUtil.isNull(startTime)){ |
|
|
|
//如果是空,查全部
|
|
|
|
endTime = null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<DockVo.PatientVisitInfo> getPatientVisitView() { |
|
|
|
Date endTime = new Date(); |
|
|
|
Date startTime = new Date(System.currentTimeMillis() - 60 * 60 * 1000); |
|
|
|
return oracleViewDao.getPatientVisitView(startTime, endTime); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void syncPatientVisitView(List<DockVo.PatientVisitInfo> sysVisits) { |
|
|
|
public List<DockVo.PatientVisitInfo> syncPatientVisitView(List<DockVo.PatientVisitInfo> sysVisits) { |
|
|
|
List<DockVo.PatientVisitInfo> visitList = new ArrayList<>(); |
|
|
|
if(CollUtil.isNotEmpty(sysVisits)){ |
|
|
|
for (DockVo.PatientVisitInfo sysVisit : sysVisits) { |
|
|
|
//根据就诊流水号查询就诊信息是否存在
|
|
|
|
DockPatientVisitInfoExample example = new DockPatientVisitInfoExample(); |
|
|
|
example.createCriteria().andVisitNoEqualTo(sysVisit.getVisitNo()); |
|
|
|
long l = dockPatientVisitInfoMapper.countByExample(example); |
|
|
|
if(l>0){ |
|
|
|
continue; |
|
|
|
} |
|
|
|
//根据医生id查找医生code
|
|
|
|
String doctorCode = sysVisit.getDoctor(); |
|
|
|
try { |
|
|
|
DockEmpl dockEmpl = dockEmplMapper.selectByPrimaryKey(Long.valueOf(sysVisit.getDoctor())); |
|
|
|
if(ObjectUtil.isNotNull(dockEmpl)){ |
|
|
|
doctorCode = dockEmpl.getEmplCode(); |
|
|
|
} |
|
|
|
}catch (Exception e){ |
|
|
|
log.error("根据医生id查找医生code失败"); |
|
|
|
} |
|
|
|
|
|
|
|
DockPatientVisitInfo dockPatientVisit = new DockPatientVisitInfo(); |
|
|
|
dockPatientVisit.setVisitNo(sysVisit.getVisitNo()); |
|
|
|
dockPatientVisit.setPatientNo(sysVisit.getPatientNo()); |
|
|
|
@ -1025,11 +1032,13 @@ public class DockServiceImpl implements DockService { |
|
|
|
dockPatientVisit.setVisitType(sysVisit.getVisitType()); |
|
|
|
dockPatientVisit.setAge(sysVisit.getAge()); |
|
|
|
dockPatientVisit.setDepartment(sysVisit.getDepartment()); |
|
|
|
dockPatientVisit.setDoctor(sysVisit.getDoctor()); |
|
|
|
dockPatientVisit.setDoctor(doctorCode); |
|
|
|
dockPatientVisit.setAdmissionDate(sysVisit.getAdmissionDate()); |
|
|
|
dockPatientVisit.setAdmissionCount(sysVisit.getAdmissionCount()); |
|
|
|
dockPatientVisit.setBedNumber(sysVisit.getBedNumber()); |
|
|
|
dockPatientVisit.setDischargeDate(sysVisit.getDischargeDate()); |
|
|
|
if(StrUtil.isNotEmpty(sysVisit.getDischargeDate())){ |
|
|
|
dockPatientVisit.setDischargeDate(DateUtil.parse(sysVisit.getDischargeDate(), "yyyy-MM-dd")); |
|
|
|
} |
|
|
|
dockPatientVisit.setAdmissionMethod(sysVisit.getAdmissionMethod()); |
|
|
|
dockPatientVisit.setDischargeMethod(sysVisit.getDischargeMethod()); |
|
|
|
dockPatientVisit.setHeight(sysVisit.getHeight()); |
|
|
|
@ -1058,19 +1067,112 @@ public class DockServiceImpl implements DockService { |
|
|
|
dockPatientVisit.setAllergyDrug(sysVisit.getAllergyDrug()); |
|
|
|
dockPatientVisit.setSync(String.valueOf(0)); |
|
|
|
dockPatientVisitInfoMapper.insertSelective(dockPatientVisit); |
|
|
|
visitList.add(sysVisit); |
|
|
|
} |
|
|
|
} |
|
|
|
return visitList; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<DockVo.DiagnosisInfo> getDiagnosisView() { |
|
|
|
Date endTime = new Date(); |
|
|
|
Date startTime = new Date(System.currentTimeMillis() - 60 * 60 * 1000); |
|
|
|
return oracleViewDao.getDiagnosisView(startTime, endTime); |
|
|
|
public List<DockVo.PatientBasicInfo> getPatientBasicView(List<String> patientNos) { |
|
|
|
// return oracleViewDao.getPatientBasicView(patientNos);
|
|
|
|
|
|
|
|
if (CollUtil.isEmpty(patientNos)) { |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
|
|
|
|
List<DockVo.PatientBasicInfo> result = new ArrayList<>(); |
|
|
|
int batchSize = 100; |
|
|
|
|
|
|
|
for (int i = 0; i < patientNos.size(); i += batchSize) { |
|
|
|
int end = Math.min(i + batchSize, patientNos.size()); |
|
|
|
List<String> batchList = patientNos.subList(i, end); |
|
|
|
result.addAll(oracleViewDao.getPatientBasicView(batchList)); |
|
|
|
} |
|
|
|
|
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void syncPatientBasicView(List<DockVo.PatientBasicInfo> sysPatients) { |
|
|
|
log.info("通过患者编号拉取到的患者信息:{}", sysPatients.size()); |
|
|
|
if(CollUtil.isNotEmpty(sysPatients)){ |
|
|
|
for (DockVo.PatientBasicInfo sysPatient : sysPatients) { |
|
|
|
DockPatientBaseInfo dockPatientBase = new DockPatientBaseInfo(); |
|
|
|
dockPatientBase.setName(sysPatient.getName()); |
|
|
|
dockPatientBase.setPatientNo(sysPatient.getPatientNo()); |
|
|
|
dockPatientBase.setIdCard(sysPatient.getIdCard()); |
|
|
|
dockPatientBase.setPhone(sysPatient.getPhone()); |
|
|
|
//处理性别
|
|
|
|
if(StrUtil.isNotEmpty(sysPatient.getSex())){ |
|
|
|
if("1".equals(sysPatient.getSex())){ |
|
|
|
dockPatientBase.setSex("0"); |
|
|
|
}else if("0".equals(sysPatient.getSex())){ |
|
|
|
dockPatientBase.setSex("1"); |
|
|
|
}else { |
|
|
|
dockPatientBase.setSex(sysPatient.getSex()); |
|
|
|
} |
|
|
|
} |
|
|
|
dockPatientBase.setBirthday(sysPatient.getBirthday()); |
|
|
|
dockPatientBase.setEducationalStatus(sysPatient.getEducationalStatus()); |
|
|
|
dockPatientBase.setCareer(sysPatient.getCareer()); |
|
|
|
//处理婚姻状况
|
|
|
|
if(StrUtil.isNotEmpty(sysPatient.getMaritalStatus())){ |
|
|
|
if ("0".equals(sysPatient.getMaritalStatus())){ |
|
|
|
dockPatientBase.setMaritalStatus("1"); |
|
|
|
}else if("1".equals(sysPatient.getMaritalStatus())){ |
|
|
|
dockPatientBase.setMaritalStatus("2"); |
|
|
|
}else if("2".equals(sysPatient.getMaritalStatus())){ |
|
|
|
dockPatientBase.setMaritalStatus("3"); |
|
|
|
}else if ("3".equals(sysPatient.getMaritalStatus())){ |
|
|
|
dockPatientBase.setMaritalStatus("4"); |
|
|
|
}else if ("4".equals(sysPatient.getMaritalStatus())){ |
|
|
|
dockPatientBase.setMaritalStatus("5"); |
|
|
|
}else { |
|
|
|
dockPatientBase.setMaritalStatus(sysPatient.getMaritalStatus()); |
|
|
|
} |
|
|
|
} |
|
|
|
dockPatientBase.setNation(sysPatient.getNation()); |
|
|
|
dockPatientBase.setNativePlace(sysPatient.getNativePlace()); |
|
|
|
dockPatientBase.setAddress(sysPatient.getAddress()); |
|
|
|
dockPatientBase.setDwellingState(sysPatient.getDwellingState()); |
|
|
|
dockPatientBase.setContactName(sysPatient.getContactName()); |
|
|
|
dockPatientBase.setContactMobile(sysPatient.getContactMobile()); |
|
|
|
dockPatientBase.setContactRelation(sysPatient.getContactRelation()); |
|
|
|
dockPatientBase.setAboBloodType(sysPatient.getAboBloodType()); |
|
|
|
dockPatientBase.setRhBloodType(sysPatient.getRhBloodType()); |
|
|
|
dockPatientBase.setBelief(sysPatient.getBelief()); |
|
|
|
dockPatientBase.setHobby(sysPatient.getHobby()); |
|
|
|
dockPatientBase.setSync(String.valueOf(0)); |
|
|
|
dockPatientBaseInfoMapper.insertSelective(dockPatientBase); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public List<DockVo.DiagnosisInfo> getDiagnosisView(List<String> visitNos) { |
|
|
|
// return oracleViewDao.getDiagnosisView(visitNos);
|
|
|
|
if (CollUtil.isEmpty(visitNos)) { |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
|
|
|
|
List<DockVo.DiagnosisInfo> result = new ArrayList<>(); |
|
|
|
int batchSize = 100; |
|
|
|
|
|
|
|
for (int i = 0; i < visitNos.size(); i += batchSize) { |
|
|
|
int end = Math.min(i + batchSize, visitNos.size()); |
|
|
|
List<String> batchList = visitNos.subList(i, end); |
|
|
|
result.addAll(oracleViewDao.getDiagnosisView(batchList)); |
|
|
|
} |
|
|
|
|
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void syncDiagnosisView(List<DockVo.DiagnosisInfo> sysDiagnosis) { |
|
|
|
log.info("通过就诊号拉取到的患者诊断信息:{}", sysDiagnosis.size()); |
|
|
|
if(CollUtil.isNotEmpty(sysDiagnosis)){ |
|
|
|
for (DockVo.DiagnosisInfo sysDiagnosi : sysDiagnosis) { |
|
|
|
DockPatientDiagnosis dockDiagnosis = new DockPatientDiagnosis(); |
|
|
|
@ -1087,14 +1189,27 @@ public class DockServiceImpl implements DockService { |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<DockVo.MedicationInfo> getMedicationView() { |
|
|
|
Date endTime = new Date(); |
|
|
|
Date startTime = new Date(System.currentTimeMillis() - 60 * 60 * 1000); |
|
|
|
return oracleViewDao.getMedicationView(startTime, endTime); |
|
|
|
public List<DockVo.MedicationInfo> getMedicationView(List<String> visitNos) { |
|
|
|
// return oracleViewDao.getMedicationView(visitNos);
|
|
|
|
if (CollUtil.isEmpty(visitNos)) { |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
|
|
|
|
List<DockVo.MedicationInfo> result = new ArrayList<>(); |
|
|
|
int batchSize = 100; |
|
|
|
|
|
|
|
for (int i = 0; i < visitNos.size(); i += batchSize) { |
|
|
|
int end = Math.min(i + batchSize, visitNos.size()); |
|
|
|
List<String> batchList = visitNos.subList(i, end); |
|
|
|
result.addAll(oracleViewDao.getMedicationView(batchList)); |
|
|
|
} |
|
|
|
|
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void syncMedicationView(List<DockVo.MedicationInfo> sysMedications) { |
|
|
|
log.info("通过就诊号拉取到的患者用药信息:{}", sysMedications.size()); |
|
|
|
if(CollUtil.isNotEmpty(sysMedications)){ |
|
|
|
for (DockVo.MedicationInfo sysMedication : sysMedications) { |
|
|
|
DockPatientMedicationInfo dockMedication = new DockPatientMedicationInfo(); |
|
|
|
@ -1109,4 +1224,15 @@ public class DockServiceImpl implements DockService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Date getPatientVisitLastDate() { |
|
|
|
DockPatientVisitInfoExample example = new DockPatientVisitInfoExample(); |
|
|
|
example.setOrderByClause("admission_date desc limit 1"); |
|
|
|
List<DockPatientVisitInfo> dockPatientVisitInfos = dockPatientVisitInfoMapper.selectByExample(example); |
|
|
|
if(CollUtil.isNotEmpty(dockPatientVisitInfos)){ |
|
|
|
return dockPatientVisitInfos.get(0).getAdmissionDate(); |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|