|
|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package com.docus.server.collection.controller;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.docus.infrastructure.web.api.CommonResult;
|
|
|
|
|
import com.docus.server.collection.dto.*;
|
|
|
|
|
import com.docus.server.collection.service.IPowerDeptService;
|
|
|
|
|
@ -35,13 +36,14 @@ public class SzyZhController {
|
|
|
|
|
if (ObjectUtil.isEmpty(dtos)) {
|
|
|
|
|
return CommonResult.failed("数据为空");
|
|
|
|
|
}
|
|
|
|
|
log.info("基础数据同步,数据:{}",JSON.toJSONString(dtos));
|
|
|
|
|
for (SzyTBasicDto dto : dtos) {
|
|
|
|
|
if (ObjectUtil.isEmpty(dto.getInpatientNo())) {
|
|
|
|
|
log.error("住院号为空"+dto.toString());
|
|
|
|
|
log.error("基础数据同步,住院号为空!" );
|
|
|
|
|
return CommonResult.failed("住院号为空");
|
|
|
|
|
}
|
|
|
|
|
if (ObjectUtil.isEmpty(dto.getJzh())) {
|
|
|
|
|
log.error("住院号为空"+dto.toString());
|
|
|
|
|
log.error("基础数据同步,住院流水号为空!" );
|
|
|
|
|
return CommonResult.failed("住院流水号为空");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -55,19 +57,22 @@ public class SzyZhController {
|
|
|
|
|
if (ObjectUtil.isEmpty(dtos)) {
|
|
|
|
|
return CommonResult.failed("数据为空");
|
|
|
|
|
}
|
|
|
|
|
log.info("科室数据同步,数据:{}", JSON.toJSONString(dtos));
|
|
|
|
|
boolean success = true;
|
|
|
|
|
for (SzyDeptDto dto : dtos) {
|
|
|
|
|
if(ObjectUtil.isEmpty(dto.getDeptCode())){
|
|
|
|
|
log.error("科室编号为空"+dto.toString());
|
|
|
|
|
return CommonResult.failed("科室编号为空");
|
|
|
|
|
}
|
|
|
|
|
if(ObjectUtil.isEmpty(dto.getDeptName())){
|
|
|
|
|
log.error("科室名为空"+dto.toString());
|
|
|
|
|
return CommonResult.failed("科室名为空");
|
|
|
|
|
if (ObjectUtil.isEmpty(dto.getDeptCode()) || ObjectUtil.isEmpty(dto.getDeptName())) {
|
|
|
|
|
success = false;
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
powerDeptService.add(dto);
|
|
|
|
|
}
|
|
|
|
|
if (success) {
|
|
|
|
|
return CommonResult.success("同步成功");
|
|
|
|
|
}
|
|
|
|
|
log.error("科室数据同步失败,数据中有科室编号或科室名称为空!");
|
|
|
|
|
return CommonResult.failed("同步失败,数据中有科室编号或科室名称为空!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ApiOperation("用户数据同步")
|
|
|
|
|
@PostMapping("/setUser")
|
|
|
|
|
@ -75,13 +80,19 @@ public class SzyZhController {
|
|
|
|
|
if (ObjectUtil.isEmpty(dtos)) {
|
|
|
|
|
return CommonResult.failed("数据为空");
|
|
|
|
|
}
|
|
|
|
|
log.info("用户数据同步,数据:{}", JSON.toJSONString(dtos));
|
|
|
|
|
boolean success = true;
|
|
|
|
|
for (SzyUserDto dto : dtos) {
|
|
|
|
|
if (ObjectUtil.isEmpty(dto.getUserName())) {
|
|
|
|
|
log.error("用户工号为空"+dto.toString());
|
|
|
|
|
return CommonResult.failed("用户工号为空");
|
|
|
|
|
success = false;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
powerUserService.add(dto);
|
|
|
|
|
}
|
|
|
|
|
if (success) {
|
|
|
|
|
return CommonResult.success("同步成功");
|
|
|
|
|
}
|
|
|
|
|
log.error("用户数据同步失败,数据中有工号为空!");
|
|
|
|
|
return CommonResult.failed("同步失败,数据中有工号为空!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|