员工岗位修改
This commit is contained in:
@@ -0,0 +1,47 @@
|
|||||||
|
package com.openhis.web.basedatamanage.appservice;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
import com.core.common.core.domain.R;
|
||||||
|
import com.openhis.web.basedatamanage.dto.PractSearchParam;
|
||||||
|
import com.openhis.web.basedatamanage.dto.PractitionerDto;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Practitioner 应该服务类
|
||||||
|
*/
|
||||||
|
public interface IPractitionerAppService {
|
||||||
|
/**
|
||||||
|
* 查询员工信息
|
||||||
|
*
|
||||||
|
* @param pageNo 当前页码
|
||||||
|
* @param pageSize 查询条数
|
||||||
|
* @param request 请求数据
|
||||||
|
* @return 员工分页列表
|
||||||
|
*/
|
||||||
|
R<?> getPractitionerPage(PractSearchParam practSearchParam, String searchKey, Integer pageNo, Integer pageSize,
|
||||||
|
HttpServletRequest request);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 员工信息详情
|
||||||
|
*
|
||||||
|
* @param practitionerId 员工信息id
|
||||||
|
* @return 员工信息详情
|
||||||
|
*/
|
||||||
|
R<?> getPractitionerById(Long practitionerId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加/编辑员工信息
|
||||||
|
*
|
||||||
|
* @param practitionerDto 员工信息
|
||||||
|
* @return 操作结果
|
||||||
|
*/
|
||||||
|
R<?> addOrEditPractitioner(PractitionerDto practitionerDto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 员工信息
|
||||||
|
*
|
||||||
|
* @param practitionerId 员工信息id
|
||||||
|
* @return 操作结果
|
||||||
|
*/
|
||||||
|
R<?> deletePractitioner(Long practitionerId);
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package com.openhis.web.basedatamanage.appservice;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
import com.core.common.core.domain.R;
|
||||||
|
import com.openhis.web.basedatamanage.dto.PractRoleSearchParam;
|
||||||
|
import com.openhis.web.basedatamanage.dto.PractitionerRoleDto;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PractitionerRole 应该服务类
|
||||||
|
*/
|
||||||
|
public interface IPractitionerRoleAppService {
|
||||||
|
/**
|
||||||
|
* 查询岗位
|
||||||
|
*
|
||||||
|
* @param pageNo 当前页码
|
||||||
|
* @param pageSize 查询条数
|
||||||
|
* @param request 请求数据
|
||||||
|
* @return 岗位分页列表
|
||||||
|
*/
|
||||||
|
R<?> getPractitionerPage(PractRoleSearchParam practRoleSearchParam, String searchKey, Integer pageNo,
|
||||||
|
Integer pageSize, HttpServletRequest request);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 岗位信息详情
|
||||||
|
*
|
||||||
|
* @param practitionerRoleId 岗位信息id
|
||||||
|
* @return 岗位信息详情
|
||||||
|
*/
|
||||||
|
R<?> getPractitionerRoleById(Long practitionerRoleId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加/编辑岗位信息
|
||||||
|
*
|
||||||
|
* @param practitionerRoleDto 岗位信息
|
||||||
|
* @return 操作结果
|
||||||
|
*/
|
||||||
|
R<?> addOrEditPractitionerRole(PractitionerRoleDto practitionerRoleDto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 岗位信息
|
||||||
|
*
|
||||||
|
* @param practitionerRoleId 岗位信息id
|
||||||
|
* @return 操作结果
|
||||||
|
*/
|
||||||
|
R<?> deletePractitionerRole(Long practitionerRoleId);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,117 @@
|
|||||||
|
package com.openhis.web.basedatamanage.appservice.impl;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.core.common.core.domain.R;
|
||||||
|
import com.core.common.utils.MessageUtils;
|
||||||
|
import com.openhis.administration.domain.Practitioner;
|
||||||
|
import com.openhis.administration.domain.PractitionerRole;
|
||||||
|
import com.openhis.administration.mapper.PractitionerMapper;
|
||||||
|
import com.openhis.administration.service.IPractitionerRoleService;
|
||||||
|
import com.openhis.administration.service.IPractitionerService;
|
||||||
|
import com.openhis.common.constant.PromptMsgConstant;
|
||||||
|
import com.openhis.common.utils.HisPageUtils;
|
||||||
|
import com.openhis.common.utils.HisQueryUtils;
|
||||||
|
import com.openhis.web.basedatamanage.appservice.IPractitionerAppService;
|
||||||
|
import com.openhis.web.basedatamanage.dto.PractSearchParam;
|
||||||
|
import com.openhis.web.basedatamanage.dto.PractitionerDto;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class PractitionerAppServiceImpl implements IPractitionerAppService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IPractitionerService practitionerService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PractitionerMapper practitionerMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IPractitionerRoleService practitionerRoleService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public R<?> getPractitionerPage(PractSearchParam practSearchParam, String searchKey, Integer pageNo,
|
||||||
|
Integer pageSize, HttpServletRequest request) {
|
||||||
|
|
||||||
|
// 构建查询条件
|
||||||
|
QueryWrapper<Practitioner> queryWrapper = HisQueryUtils.buildQueryWrapper(practSearchParam, searchKey,
|
||||||
|
new HashSet<>(Arrays.asList("name", "py_str", "wb_str")), request);
|
||||||
|
|
||||||
|
// 查询员工分页列表
|
||||||
|
Page<PractitionerDto> practitionerDtoPage =
|
||||||
|
HisPageUtils.selectPage(practitionerMapper, queryWrapper, pageNo, pageSize, PractitionerDto.class);
|
||||||
|
|
||||||
|
return R.ok(practitionerDtoPage,
|
||||||
|
MessageUtils.createMessage(PromptMsgConstant.Common.M00009, new Object[] {"员工信息"}));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 员工信息详情
|
||||||
|
*
|
||||||
|
* @param practitionerId 员工信息id
|
||||||
|
* @return 员工信息详情
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public R<?> getPractitionerById(Long practitionerId) {
|
||||||
|
Practitioner practitioner = practitionerService.getById(practitionerId);
|
||||||
|
if (practitioner != null) {
|
||||||
|
return R.ok(practitioner,
|
||||||
|
MessageUtils.createMessage(PromptMsgConstant.Common.M00009, new Object[] {"员工信息"}));
|
||||||
|
} else {
|
||||||
|
return R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, new Object[] {"员工信息查询失败"}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加/编辑员工信息
|
||||||
|
*
|
||||||
|
* @param practitionerDto 员工信息
|
||||||
|
* @return 操作结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public R<?> addOrEditPractitioner(PractitionerDto practitionerDto) {
|
||||||
|
|
||||||
|
Practitioner practitioner = new Practitioner();
|
||||||
|
BeanUtils.copyProperties(practitionerDto, practitioner);
|
||||||
|
PractitionerRole practitionerRole = new PractitionerRole();
|
||||||
|
|
||||||
|
if (practitionerDto.getId() != null) {
|
||||||
|
// 更新员工信息
|
||||||
|
practitionerService.updateById(practitioner);
|
||||||
|
} else {
|
||||||
|
// 新增员工信息
|
||||||
|
practitionerService.save(practitioner);
|
||||||
|
|
||||||
|
// 新增员工岗位信息
|
||||||
|
practitionerRole.setPractitionerId(practitioner.getId());
|
||||||
|
practitionerRole.setName(practitioner.getName());
|
||||||
|
practitionerRoleService.save(practitionerRole);
|
||||||
|
}
|
||||||
|
// 返回员工id
|
||||||
|
return R.ok(practitioner.getId(),
|
||||||
|
MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"员工信息更新添加"}));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除员工
|
||||||
|
*
|
||||||
|
* @param practitionerId 员工信息id
|
||||||
|
* @return 操作结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public R<?> deletePractitioner(Long practitionerId) {
|
||||||
|
// 删除员工信息
|
||||||
|
boolean deletepractitioner = practitionerService.removeById(practitionerId);
|
||||||
|
return deletepractitioner
|
||||||
|
? R.ok(practitionerId, MessageUtils.createMessage(PromptMsgConstant.Common.M00005, new Object[] {"员工信息"}))
|
||||||
|
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, new Object[] {"员工信息"}));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,117 @@
|
|||||||
|
package com.openhis.web.basedatamanage.appservice.impl;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.core.common.core.domain.R;
|
||||||
|
import com.core.common.utils.MessageUtils;
|
||||||
|
import com.openhis.administration.domain.PractitionerRole;
|
||||||
|
import com.openhis.administration.mapper.PractitionerRoleMapper;
|
||||||
|
import com.openhis.administration.service.IPractitionerRoleService;
|
||||||
|
import com.openhis.common.constant.PromptMsgConstant;
|
||||||
|
import com.openhis.common.utils.HisPageUtils;
|
||||||
|
import com.openhis.common.utils.HisQueryUtils;
|
||||||
|
import com.openhis.web.basedatamanage.appservice.IPractitionerRoleAppService;
|
||||||
|
import com.openhis.web.basedatamanage.dto.PractRoleSearchParam;
|
||||||
|
import com.openhis.web.basedatamanage.dto.PractitionerRoleDto;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class PractitionerRoleAppServiceImpl implements IPractitionerRoleAppService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IPractitionerRoleService practitionerRoleService;
|
||||||
|
@Autowired
|
||||||
|
private PractitionerRoleMapper practitionerRoleMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public R<?> getPractitionerPage(PractRoleSearchParam practRoleSearchParam, String searchKey, Integer pageNo,
|
||||||
|
Integer pageSize, HttpServletRequest request) {
|
||||||
|
|
||||||
|
// 构建查询条件
|
||||||
|
QueryWrapper<PractitionerRole> queryWrapper = HisQueryUtils.buildQueryWrapper(practRoleSearchParam, searchKey,
|
||||||
|
new HashSet<>(Arrays.asList("name")), request);
|
||||||
|
|
||||||
|
// 查询岗位分页列表
|
||||||
|
Page<PractitionerRoleDto> practitionerRoleDtoPage =
|
||||||
|
HisPageUtils.selectPage(practitionerRoleMapper, queryWrapper, pageNo, pageSize, PractitionerRoleDto.class);
|
||||||
|
|
||||||
|
return R.ok(practitionerRoleDtoPage,
|
||||||
|
MessageUtils.createMessage(PromptMsgConstant.Common.M00009, new Object[] {"岗位信息"}));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 岗位信息详情
|
||||||
|
*
|
||||||
|
* @param practitionerRoleId 岗位信息id
|
||||||
|
* @return 岗位信息详情
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public R<?> getPractitionerRoleById(Long practitionerRoleId) {
|
||||||
|
PractitionerRole practitionerRole = practitionerRoleService.getById(practitionerRoleId);
|
||||||
|
if (practitionerRole != null) {
|
||||||
|
return R.ok(practitionerRole,
|
||||||
|
MessageUtils.createMessage(PromptMsgConstant.Common.M00009, new Object[] {"岗位信息"}));
|
||||||
|
} else {
|
||||||
|
return R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, new Object[] {"岗位信息查询失败"}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加/编辑岗位信息
|
||||||
|
*
|
||||||
|
* @param practitionerRoleDto 岗位信息
|
||||||
|
* @return 操作结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public R<?> addOrEditPractitionerRole(PractitionerRoleDto practitionerRoleDto) {
|
||||||
|
|
||||||
|
PractitionerRole practitionerRole = new PractitionerRole();
|
||||||
|
BeanUtils.copyProperties(practitionerRoleDto, practitionerRole);
|
||||||
|
// if (practitionerRole.getRoleCode() == null) {
|
||||||
|
// return R.fail(PromptMsgConstant.Common.M00007, "角色编码不能为空");
|
||||||
|
// }
|
||||||
|
// if (practitionerRole.getOrgId() == null) {
|
||||||
|
// return R.fail(PromptMsgConstant.Common.M00007, "科室不能为空");
|
||||||
|
// }
|
||||||
|
// if (practitionerRole.getLocationId() == null) {
|
||||||
|
// return R.fail(PromptMsgConstant.Common.M00007, "位置不能为空");
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (practitionerRoleDto.getId() != null) {
|
||||||
|
// 更新岗位信息
|
||||||
|
practitionerRoleService.updateById(practitionerRole);
|
||||||
|
} else {
|
||||||
|
// 新增岗位信息
|
||||||
|
// practitionerRoleService.save(practitionerRole);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 返回岗位id
|
||||||
|
return R.ok(practitionerRole.getId(),
|
||||||
|
MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"岗位信息更新添加"}));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除岗位
|
||||||
|
*
|
||||||
|
* @param practitionerRoleId 岗位信息id
|
||||||
|
* @return 操作结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public R<?> deletePractitionerRole(Long practitionerRoleId) {
|
||||||
|
// 删除岗位信息
|
||||||
|
boolean deletePractitionerRole = practitionerRoleService.removeById(practitionerRoleId);
|
||||||
|
return deletePractitionerRole
|
||||||
|
? R.ok(practitionerRoleId,
|
||||||
|
MessageUtils.createMessage(PromptMsgConstant.Common.M00005, new Object[] {"岗位信息"}))
|
||||||
|
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, new Object[] {"岗位信息"}));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -3,31 +3,14 @@
|
|||||||
*/
|
*/
|
||||||
package com.openhis.web.basedatamanage.controller;
|
package com.openhis.web.basedatamanage.controller;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashSet;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import org.springframework.beans.BeanUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.core.common.core.domain.R;
|
import com.core.common.core.domain.R;
|
||||||
import com.core.common.utils.MessageUtils;
|
import com.openhis.web.basedatamanage.appservice.IPractitionerAppService;
|
||||||
import com.openhis.administration.domain.Practitioner;
|
|
||||||
import com.openhis.administration.domain.PractitionerRole;
|
|
||||||
import com.openhis.administration.mapper.PractitionerMapper;
|
|
||||||
import com.openhis.administration.mapper.PractitionerRoleMapper;
|
|
||||||
import com.openhis.administration.service.IPractitionerService;
|
|
||||||
import com.openhis.common.constant.PromptMsgConstant;
|
|
||||||
import com.openhis.common.enums.AccountStatus;
|
|
||||||
import com.openhis.common.enums.AdministrativeGender;
|
|
||||||
import com.openhis.common.utils.EnumUtils;
|
|
||||||
import com.openhis.common.utils.HisPageUtils;
|
|
||||||
import com.openhis.common.utils.HisQueryUtils;
|
|
||||||
import com.openhis.web.basedatamanage.dto.PractSearchParam;
|
import com.openhis.web.basedatamanage.dto.PractSearchParam;
|
||||||
import com.openhis.web.basedatamanage.dto.PractitionerDto;
|
import com.openhis.web.basedatamanage.dto.PractitionerDto;
|
||||||
|
|
||||||
@@ -46,13 +29,8 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class PractitionerController {
|
public class PractitionerController {
|
||||||
|
|
||||||
private final IPractitionerService practitionerService;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private PractitionerMapper practitionerMapper;
|
private IPractitionerAppService practitionerAppService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private PractitionerRoleMapper practitionerRoleMapper;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 员工分页列表
|
* 员工分页列表
|
||||||
@@ -68,57 +46,7 @@ public class PractitionerController {
|
|||||||
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
|
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
|
||||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
|
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
|
||||||
|
return practitionerAppService.getPractitionerPage(practSearchParam, searchKey, pageNo, pageSize, request);
|
||||||
// 构建查询条件
|
|
||||||
QueryWrapper<Practitioner> queryWrapper = HisQueryUtils.buildQueryWrapper(practSearchParam, searchKey,
|
|
||||||
new HashSet<>(Arrays.asList("name", "py_str", "wb_str")), request);
|
|
||||||
|
|
||||||
// 设置排序
|
|
||||||
queryWrapper.orderByDesc("name");
|
|
||||||
|
|
||||||
// 执行分页查询并转换为 practitionerDtoPage
|
|
||||||
Page<PractitionerDto> practitionerDtoPage =
|
|
||||||
HisPageUtils.selectPage(practitionerMapper, queryWrapper, pageNo, pageSize, PractitionerDto.class);
|
|
||||||
|
|
||||||
practitionerDtoPage.getRecords().forEach(e -> {
|
|
||||||
// 性别回显赋值
|
|
||||||
e.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum()));
|
|
||||||
});
|
|
||||||
|
|
||||||
return R.ok(practitionerDtoPage,
|
|
||||||
MessageUtils.createMessage(PromptMsgConstant.Common.M00009, new Object[] {"员工信息"}));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加员工信息
|
|
||||||
*
|
|
||||||
* @param practitionerDto 员工信息
|
|
||||||
*/
|
|
||||||
@PostMapping("/practitioner")
|
|
||||||
public R<?> addPractitioner(@Validated @RequestBody PractitionerDto practitionerDto) {
|
|
||||||
|
|
||||||
// 新增practitioner信息
|
|
||||||
Practitioner practitioner = new Practitioner();
|
|
||||||
BeanUtils.copyProperties(practitionerDto, practitioner);
|
|
||||||
practitioner.setActiveFlag(AccountStatus.ACTIVE.getValue());
|
|
||||||
|
|
||||||
boolean savePractitionerSuccess = practitionerService.save(practitioner);
|
|
||||||
|
|
||||||
PractitionerRole practitionerRole = new PractitionerRole();
|
|
||||||
practitionerRole.setPractitionerId(practitioner.getId());
|
|
||||||
practitionerRole.setName(practitioner.getName());
|
|
||||||
Integer saveProleSuccess = practitionerRoleMapper.insert(practitionerRole);
|
|
||||||
|
|
||||||
boolean saveFlag;
|
|
||||||
if (savePractitionerSuccess && saveProleSuccess == 1) {
|
|
||||||
saveFlag = true;
|
|
||||||
} else {
|
|
||||||
saveFlag = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return saveFlag ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00001, new Object[] {"员工信息"}))
|
|
||||||
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, new Object[] {"员工信息"}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -128,14 +56,7 @@ public class PractitionerController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping("/practitioner-getById")
|
@GetMapping("/practitioner-getById")
|
||||||
public R<?> getPractitionerById(@Validated @RequestParam Long practitionerId) {
|
public R<?> getPractitionerById(@Validated @RequestParam Long practitionerId) {
|
||||||
|
return practitionerAppService.getPractitionerById(practitionerId);
|
||||||
Practitioner practitioner = practitionerService.getById(practitionerId);
|
|
||||||
if (practitioner != null) {
|
|
||||||
return R.ok(practitioner,
|
|
||||||
MessageUtils.createMessage(PromptMsgConstant.Common.M00009, new Object[] {"员工信息"}));
|
|
||||||
} else {
|
|
||||||
return R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, new Object[] {"员工信息查新失败"}));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -144,17 +65,8 @@ public class PractitionerController {
|
|||||||
* @param practitionerDto 员工信息
|
* @param practitionerDto 员工信息
|
||||||
*/
|
*/
|
||||||
@PutMapping("/practitioner")
|
@PutMapping("/practitioner")
|
||||||
public R<?> editPractitioner(@Validated @RequestBody PractitionerDto practitionerDto) {
|
public R<?> addOrEditPractitioner(@Validated @RequestBody PractitionerDto practitionerDto) {
|
||||||
|
return practitionerAppService.addOrEditPractitioner(practitionerDto);
|
||||||
// 编辑practitioner信息
|
|
||||||
Practitioner practitioner = new Practitioner();
|
|
||||||
BeanUtils.copyProperties(practitionerDto, practitioner);
|
|
||||||
|
|
||||||
boolean editPractitionerSuccess = practitionerService.updateById(practitioner);
|
|
||||||
|
|
||||||
return editPractitionerSuccess
|
|
||||||
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"员工信息"}))
|
|
||||||
: R.fail(PromptMsgConstant.Common.M00007, null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -164,12 +76,7 @@ public class PractitionerController {
|
|||||||
*/
|
*/
|
||||||
@DeleteMapping("/practitioner")
|
@DeleteMapping("/practitioner")
|
||||||
public R<?> deletePractitioner(@RequestParam Long practitionerId) {
|
public R<?> deletePractitioner(@RequestParam Long practitionerId) {
|
||||||
|
return practitionerAppService.deletePractitioner(practitionerId);
|
||||||
boolean delPractitionerSuccess = practitionerService.removeById(practitionerId);
|
|
||||||
|
|
||||||
return delPractitionerSuccess
|
|
||||||
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00005, new Object[] {"员工信息"}))
|
|
||||||
: R.fail(PromptMsgConstant.Common.M00006, null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,26 +3,14 @@
|
|||||||
*/
|
*/
|
||||||
package com.openhis.web.basedatamanage.controller;
|
package com.openhis.web.basedatamanage.controller;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashSet;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import org.springframework.beans.BeanUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.core.common.core.domain.R;
|
import com.core.common.core.domain.R;
|
||||||
import com.core.common.utils.MessageUtils;
|
import com.openhis.web.basedatamanage.appservice.IPractitionerRoleAppService;
|
||||||
import com.openhis.administration.domain.PractitionerRole;
|
|
||||||
import com.openhis.administration.mapper.PractitionerRoleMapper;
|
|
||||||
import com.openhis.administration.service.IPractitionerRoleService;
|
|
||||||
import com.openhis.common.constant.PromptMsgConstant;
|
|
||||||
import com.openhis.common.utils.HisPageUtils;
|
|
||||||
import com.openhis.common.utils.HisQueryUtils;
|
|
||||||
import com.openhis.web.basedatamanage.dto.PractRoleSearchParam;
|
import com.openhis.web.basedatamanage.dto.PractRoleSearchParam;
|
||||||
import com.openhis.web.basedatamanage.dto.PractitionerRoleDto;
|
import com.openhis.web.basedatamanage.dto.PractitionerRoleDto;
|
||||||
|
|
||||||
@@ -41,10 +29,8 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class PractitionerRoleController {
|
public class PractitionerRoleController {
|
||||||
|
|
||||||
private final IPractitionerRoleService practitionerRoleService;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private PractitionerRoleMapper practitionerRoleMapper;
|
private IPractitionerRoleAppService practitionerRoleAppService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 岗位分页列表
|
* 岗位分页列表
|
||||||
@@ -60,53 +46,18 @@ public class PractitionerRoleController {
|
|||||||
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
|
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
|
||||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
|
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
|
||||||
|
return practitionerRoleAppService.getPractitionerPage(practRoleSearchParam, searchKey, pageNo, pageSize,
|
||||||
// 构建查询条件
|
request);
|
||||||
QueryWrapper<PractitionerRole> queryWrapper = HisQueryUtils.buildQueryWrapper(practRoleSearchParam, searchKey,
|
|
||||||
new HashSet<>(Arrays.asList("name")), request);
|
|
||||||
|
|
||||||
// 设置排序
|
|
||||||
queryWrapper.orderByDesc("create_time");
|
|
||||||
|
|
||||||
// 执行分页查询并转换为 practitionerRoleDtoPage
|
|
||||||
Page<PractitionerRoleDto> practitionerRoleDtoPage =
|
|
||||||
HisPageUtils.selectPage(practitionerRoleMapper, queryWrapper, pageNo, pageSize, PractitionerRoleDto.class);
|
|
||||||
|
|
||||||
return R.ok(practitionerRoleDtoPage,
|
|
||||||
MessageUtils.createMessage(PromptMsgConstant.Common.M00009, new Object[] {"机构信息"}));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
|
||||||
// * 添加岗位信息
|
|
||||||
// *
|
|
||||||
// * @param practitionerRoleDto 岗位信息
|
|
||||||
// */
|
|
||||||
// @PostMapping("/practitioner-role")
|
|
||||||
// public R<?> addPractitionerRole(@Validated @RequestBody CreatePractitionerRoleDto practitionerRoleDto) {
|
|
||||||
//
|
|
||||||
// // 新增practitionerRole信息
|
|
||||||
// PractitionerRole practitionerRole = new PractitionerRole();
|
|
||||||
// BeanUtils.copyProperties(practitionerRoleDto, practitionerRole);
|
|
||||||
//
|
|
||||||
// boolean savePractitionerRoleSuccess = practitionerRoleService.save(practitionerRole);
|
|
||||||
//
|
|
||||||
// return savePractitionerRoleSuccess
|
|
||||||
// ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00001, new Object[] {"岗位信息"}))
|
|
||||||
// : R.fail(PromptMsgConstant.Common.M00007, null);
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取岗位需要编辑的信息
|
* 获取岗位需要编辑的信息
|
||||||
*
|
*
|
||||||
* @param proleId 岗位信息
|
* @param practitionerRoleId 岗位信息
|
||||||
*/
|
*/
|
||||||
@GetMapping("/practitioner-role-getById")
|
@GetMapping("/practitioner-role-getById")
|
||||||
public R<?> getPractitionerRoleById(@Validated @RequestParam Long proleId) {
|
public R<?> getPractitionerRoleById(@Validated @RequestParam Long practitionerRoleId) {
|
||||||
|
return practitionerRoleAppService.getPractitionerRoleById(practitionerRoleId);
|
||||||
PractitionerRole practitionerRole = practitionerRoleService.getById(proleId);
|
|
||||||
return R.ok(practitionerRole,
|
|
||||||
MessageUtils.createMessage(PromptMsgConstant.Common.M00009, new Object[] {"岗位信息"}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -116,40 +67,16 @@ public class PractitionerRoleController {
|
|||||||
*/
|
*/
|
||||||
@PutMapping("/practitioner-role")
|
@PutMapping("/practitioner-role")
|
||||||
public R<?> editPractitionerRole(@Validated @RequestBody PractitionerRoleDto practitionerRoleDto) {
|
public R<?> editPractitionerRole(@Validated @RequestBody PractitionerRoleDto practitionerRoleDto) {
|
||||||
|
return practitionerRoleAppService.addOrEditPractitionerRole(practitionerRoleDto);
|
||||||
// 编辑practitionerRole信息
|
|
||||||
PractitionerRole practitionerRole = new PractitionerRole();
|
|
||||||
BeanUtils.copyProperties(practitionerRoleDto, practitionerRole);
|
|
||||||
if (practitionerRole.getRoleCode() == null) {
|
|
||||||
return R.fail(PromptMsgConstant.Common.M00007, "角色编码不能为空");
|
|
||||||
}
|
|
||||||
if (practitionerRole.getOrgId() == null) {
|
|
||||||
return R.fail(PromptMsgConstant.Common.M00007, "科室不能为空");
|
|
||||||
}
|
|
||||||
if (practitionerRole.getLocationId() == null) {
|
|
||||||
return R.fail(PromptMsgConstant.Common.M00007, "位置不能为空");
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean editPractitionerRoleSuccess = practitionerRoleService.updateById(practitionerRole);
|
|
||||||
|
|
||||||
return editPractitionerRoleSuccess
|
|
||||||
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"岗位信息"}))
|
|
||||||
: R.fail(PromptMsgConstant.Common.M00007, null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除岗位信息
|
* 删除岗位信息
|
||||||
*
|
*
|
||||||
* @param prId 主表id
|
* @param practitionerRoleId 主表id
|
||||||
*/
|
*/
|
||||||
@DeleteMapping("/practitioner-role")
|
@DeleteMapping("/practitioner-role")
|
||||||
public R<?> deletePractitionerRole(@RequestParam Long prId) {
|
public R<?> deletePractitionerRole(@RequestParam Long practitionerRoleId) {
|
||||||
|
return practitionerRoleAppService.deletePractitionerRole(practitionerRoleId);
|
||||||
boolean deletePractitionerRoleSuccess = practitionerRoleService.removeById(prId);
|
|
||||||
|
|
||||||
return deletePractitionerRoleSuccess
|
|
||||||
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00005, new Object[] {"岗位信息"}))
|
|
||||||
: R.fail(PromptMsgConstant.Common.M00006, null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,10 @@ import lombok.experimental.Accessors;
|
|||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
public class PractitionerDto {
|
public class PractitionerDto {
|
||||||
|
|
||||||
|
/** ID */
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
/** 姓名 */
|
/** 姓名 */
|
||||||
@NotBlank(message = "姓名不能为空")
|
@NotBlank(message = "姓名不能为空")
|
||||||
private String name;
|
private String name;
|
||||||
|
|||||||
@@ -20,6 +20,10 @@ import lombok.experimental.Accessors;
|
|||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
public class PractitionerRoleDto {
|
public class PractitionerRoleDto {
|
||||||
|
|
||||||
|
/** ID */
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
/** 名称 */
|
/** 名称 */
|
||||||
@NotBlank(message = "角色名称不能为空")
|
@NotBlank(message = "角色名称不能为空")
|
||||||
private String name;
|
private String name;
|
||||||
|
|||||||
Reference in New Issue
Block a user