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