参与者重写 - 初始化
This commit is contained in:
@@ -1,47 +1,8 @@
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -1,117 +1,16 @@
|
||||
package com.openhis.web.basedatamanage.appservice.impl;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import javax.annotation.Resource;
|
||||
|
||||
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;
|
||||
import com.openhis.web.basedatamanage.mapper.PractitionerAppAppMapper;
|
||||
|
||||
@Service
|
||||
public class PractitionerAppServiceImpl implements IPractitionerAppService {
|
||||
|
||||
@Autowired
|
||||
private IPractitionerService practitionerService;
|
||||
@Resource
|
||||
PractitionerAppAppMapper practitionerAppAppMapper;
|
||||
|
||||
@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[] {"员工信息"}));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,25 +3,16 @@
|
||||
*/
|
||||
package com.openhis.web.basedatamanage.controller;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.basedatamanage.appservice.IPractitionerAppService;
|
||||
import com.openhis.web.basedatamanage.dto.PractSearchParam;
|
||||
import com.openhis.web.basedatamanage.dto.PractitionerDto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 员工管理Controller业务层处理
|
||||
*
|
||||
* @author
|
||||
* @date 2025-02-21
|
||||
* 参与者 Controller业务层处理
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/base-data-manage/practitioner")
|
||||
@@ -29,54 +20,6 @@ import lombok.extern.slf4j.Slf4j;
|
||||
@AllArgsConstructor
|
||||
public class PractitionerController {
|
||||
|
||||
@Autowired
|
||||
private IPractitionerAppService practitionerAppService;
|
||||
|
||||
/**
|
||||
* 员工分页列表
|
||||
*
|
||||
* @param practSearchParam 查询条件
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param request 请求数据
|
||||
* @return 员工分页列表
|
||||
*/
|
||||
@GetMapping(value = "/practitioner")
|
||||
public R<?> getPractitionerPage(PractSearchParam practSearchParam,
|
||||
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
|
||||
return practitionerAppService.getPractitionerPage(practSearchParam, searchKey, pageNo, pageSize, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取员工需要编辑的信息
|
||||
*
|
||||
* @param practitionerId 员工信息
|
||||
*/
|
||||
@GetMapping("/practitioner-getById")
|
||||
public R<?> getPractitionerById(@Validated @RequestParam Long practitionerId) {
|
||||
return practitionerAppService.getPractitionerById(practitionerId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑员工信息
|
||||
*
|
||||
* @param practitionerDto 员工信息
|
||||
*/
|
||||
@PutMapping("/practitioner")
|
||||
public R<?> addOrEditPractitioner(@Validated @RequestBody PractitionerDto practitionerDto) {
|
||||
return practitionerAppService.addOrEditPractitioner(practitionerDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除员工信息
|
||||
*
|
||||
* @param practitionerId 主表id
|
||||
*/
|
||||
@DeleteMapping("/practitioner")
|
||||
public R<?> deletePractitioner(@RequestParam Long practitionerId) {
|
||||
return practitionerAppService.deletePractitioner(practitionerId);
|
||||
}
|
||||
private final IPractitionerAppService practitionerAppService;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.openhis.web.basedatamanage.mapper;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* 参与者 应用Mapper
|
||||
*/
|
||||
@Repository
|
||||
public interface PractitionerAppAppMapper {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.openhis.web.basedatamanage.mapper.PractitionerAppAppMapper">
|
||||
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user