|
@@ -33,77 +33,86 @@ public class ABasDoctorInfoFacade extends BasDoctorInfoServiceImpl {
|
|
|
* 同步历史数据
|
|
|
*/
|
|
|
public void executeDoctorPast() {
|
|
|
- String sql="select * from doctor_hos";
|
|
|
+ String sql = "select * from doctor_hos";
|
|
|
List<BasDoctorInfo> basDeptInfoList = tzDBConn.getDoctorInfo(sql);
|
|
|
execute(basDeptInfoList);
|
|
|
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 同步前一天医生信息
|
|
|
*/
|
|
|
public void executeDoctor() {
|
|
|
- String sql="select * from gi_userinfo";
|
|
|
+ String sql = "select * from gi_userinfo";
|
|
|
// List<BasDoctorInfo> basDeptInfoList = tzDBConn.getBasDoctorInfo(sql);
|
|
|
// execute(basDeptInfoList);
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 从接口接收医生信息
|
|
|
+ *
|
|
|
* @param list
|
|
|
* @return
|
|
|
*/
|
|
|
public RespDTO<List<ABasDoctorInfoDTO>> executeDoctor(List<ABasDoctorInfoVO> list) {
|
|
|
try {
|
|
|
- if(list!=null && list.size()>0){
|
|
|
- List<BasDoctorInfo> basDoctorInfoList=Lists.newArrayList();
|
|
|
- basDoctorInfoList=BeanUtil.listCopyTo(list,BasDoctorInfo.class);
|
|
|
+ if (list != null && list.size() > 0) {
|
|
|
+ List<BasDoctorInfo> basDoctorInfoList = Lists.newArrayList();
|
|
|
+ basDoctorInfoList = BeanUtil.listCopyTo(list, BasDoctorInfo.class);
|
|
|
//循环验证数据有效性
|
|
|
- for (BasDoctorInfo basDoctorInfo:basDoctorInfoList) {
|
|
|
- if("".equals(basDoctorInfo.getDoctorId())) {
|
|
|
+ for (BasDoctorInfo basDoctorInfo : basDoctorInfoList) {
|
|
|
+ if ("".equals(basDoctorInfo.getDoctorId())) {
|
|
|
return RespDTO.onError("请输入医生编码!");
|
|
|
- }else if(basDoctorInfo.getHospitalId()==null){
|
|
|
+ } else if (basDoctorInfo.getHospitalId() == null) {
|
|
|
return RespDTO.onError("请输入医院编码!");
|
|
|
}
|
|
|
}
|
|
|
execute(basDoctorInfoList);
|
|
|
|
|
|
- if(logSwitch){
|
|
|
- basDoctorInfoList.forEach(s->{
|
|
|
- aMedAbnormalInfoFacade.saveAbnormalInfo("医生信息-正常","", JSON.toJSONString(list),"","");
|
|
|
+ if (logSwitch) {
|
|
|
+ basDoctorInfoList.forEach(s -> {
|
|
|
+ aMedAbnormalInfoFacade.saveAbnormalInfo("医生信息-正常", "", JSON.toJSONString(list), "", "");
|
|
|
});
|
|
|
}
|
|
|
return RespDTO.onSuc("操作正常!");
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
return RespDTO.onError("未接收到数据!");
|
|
|
}
|
|
|
- }catch (Exception e){
|
|
|
- log.error(e.getMessage(),e);
|
|
|
- aMedAbnormalInfoFacade.saveAbnormalInfo("医生信息-异常","", JSON.toJSONString(list),"",e.getMessage());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
+ aMedAbnormalInfoFacade.saveAbnormalInfo("医生信息-异常", "", JSON.toJSONString(list), "", e.getMessage());
|
|
|
return RespDTO.onError("数据处理异常,详情查看日志表");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void execute(List<BasDoctorInfo> basDoctorInfoList){
|
|
|
- List<BasDoctorInfo> addE=Lists.newArrayList();
|
|
|
- List<BasDoctorInfo> updateE=Lists.newArrayList();
|
|
|
+ public void execute(List<BasDoctorInfo> basDoctorInfoList) {
|
|
|
+ List<BasDoctorInfo> addE = Lists.newArrayList();
|
|
|
+ List<BasDoctorInfo> updateE = Lists.newArrayList();
|
|
|
basDoctorInfoList.stream().forEach(s -> {
|
|
|
- BasDoctorInfo basDoctorInfo =this.baseMapper.selectOne(new QueryWrapper<BasDoctorInfo>()
|
|
|
- .eq("doctor_id", s.getDoctorId()));
|
|
|
- if (basDoctorInfo != null) {
|
|
|
- s.setGmtModified(new Date());
|
|
|
- QueryWrapper<BasDoctorInfo> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq("doctor_id",s.getDoctorId());
|
|
|
- this.update(s,queryWrapper);
|
|
|
+ try {
|
|
|
+ BasDoctorInfo basDoctorInfo = this.baseMapper.selectOne(new QueryWrapper<BasDoctorInfo>()
|
|
|
+ .eq("doctor_id", s.getDoctorId())
|
|
|
+ .eq("hospital_id", s.getHospitalId()));
|
|
|
+ if (basDoctorInfo != null) {
|
|
|
+ s.setGmtModified(new Date());
|
|
|
+ QueryWrapper<BasDoctorInfo> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("doctor_id", s.getDoctorId())
|
|
|
+ .eq("hospital_id", s.getHospitalId());
|
|
|
+ this.update(s, queryWrapper);
|
|
|
// updateE.add(s);
|
|
|
- } else {
|
|
|
- s.setGmtCreate(new Date());
|
|
|
- this.save(s);
|
|
|
+ } else {
|
|
|
+ s.setGmtCreate(new Date());
|
|
|
+ this.save(s);
|
|
|
// addE.add(s);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ aMedAbnormalInfoFacade.saveAbnormalInfo("保存医生信息失败", s.getDoctorId(), JSON.toJSONString(s), "", e.getMessage());
|
|
|
}
|
|
|
});
|
|
|
- if(updateE.size()>0){
|
|
|
+ if (updateE.size() > 0) {
|
|
|
basDoctorInfoService.updateBatchByKey(updateE);
|
|
|
}
|
|
|
- if(addE.size()>0){
|
|
|
+ if (addE.size() > 0) {
|
|
|
basDoctorInfoService.saveBatch(addE);
|
|
|
}
|
|
|
}
|