feat:广东省中医院珠海,用户同步优化,接口日志打印

master
WenYongbin 9 hours ago
parent 2b2319a19d
commit 2e201b2408

@ -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;
@ -32,16 +33,17 @@ public class SzyZhController {
@ApiOperation("基础数据同步")
@PostMapping("/setRecord")
public CommonResult setRecord(@RequestBody List<SzyTBasicDto> dtos) {
if(ObjectUtil.isEmpty(dtos)){
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());
if (ObjectUtil.isEmpty(dto.getInpatientNo())) {
log.error("基础数据同步,住院号为空!" );
return CommonResult.failed("住院号为空");
}
if(ObjectUtil.isEmpty(dto.getJzh())){
log.error("住院号为空"+dto.toString());
if (ObjectUtil.isEmpty(dto.getJzh())) {
log.error("基础数据同步,住院流水号为空!" );
return CommonResult.failed("住院流水号为空");
}
}
@ -52,36 +54,45 @@ public class SzyZhController {
@ApiOperation("科室数据同步")
@PostMapping("/setDept")
public CommonResult setDept(@RequestBody List<SzyDeptDto> dtos) {
if(ObjectUtil.isEmpty(dtos)){
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);
}
return CommonResult.success("同步成功");
if (success) {
return CommonResult.success("同步成功");
}
log.error("科室数据同步失败,数据中有科室编号或科室名称为空!");
return CommonResult.failed("同步失败,数据中有科室编号或科室名称为空!");
}
@ApiOperation("用户数据同步")
@PostMapping("/setUser")
public CommonResult setUser(@RequestBody List<SzyUserDto> dtos) {
if(ObjectUtil.isEmpty(dtos)){
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("用户工号为空");
if (ObjectUtil.isEmpty(dto.getUserName())) {
success = false;
continue;
}
powerUserService.add(dto);
}
return CommonResult.success("同步成功");
if (success) {
return CommonResult.success("同步成功");
}
log.error("用户数据同步失败,数据中有工号为空!");
return CommonResult.failed("同步失败,数据中有工号为空!");
}
}

@ -47,4 +47,13 @@ public class UserModifyParam {
* ID
*/
private String authorId;
/**
*
*/
private String powerDept;
/**
*
*/
private String powerAttending;
}

@ -9,6 +9,7 @@ import com.docus.server.collection.dto.UserModifyParam;
import com.docus.server.collection.infrastructure.dao.entity.PowerUser;
import com.docus.server.collection.infrastructure.dao.mapper.PowerUserMapper;
import com.docus.server.collection.service.IPowerUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -19,6 +20,7 @@ import javax.annotation.Resource;
* @author wyb
*/
@Service
@Slf4j
public class PowerUserServiceImpl implements IPowerUserService {
@Resource
private PowerUserMapper powerUserMapper;
@ -67,6 +69,9 @@ public class PowerUserServiceImpl implements IPowerUserService {
long userId = idService.getDateSeq();
userModifyParam.setUserId(userId);
userModifyParam.setUserPwd(syncConfig.getPassword());
// 新增用户,默认按照医生的标准,管辖科室设置自己科室,管辖医生设置自己
userModifyParam.setPowerDept(dto.getDeptId());
userModifyParam.setPowerAttending(dto.getUserName());
powerUserMapper.addUser(userModifyParam);
return ;
}

@ -11,12 +11,14 @@
`user_position`,
`role_id`,
`dept_id`,
`power_attending`,
`power_dept`,
`create_date`,
`creater`,
`update_date`,
`updater`)
VALUES (#{user.userId},#{user.userName},#{user.name},#{user.userPwd},#{user.position},#{user.roleId}
,#{user.deptId},now(),#{user.authorName},now(),#{user.authorName})
,#{user.deptId},#{user.powerAttending},#{user.powerDept},now(),#{user.authorName},now(),#{user.authorName})
</insert>
<update id="updateUser">
update `docus_system`.`power_user` set

Loading…
Cancel
Save