新增检查项目模块 小类
Some checks are pending
Java CI with Maven / build (11) (push) Waiting to run
Java CI with Maven / build (17) (push) Waiting to run
Java CI with Maven / build (8) (push) Waiting to run
yudao-ui-admin CI / build (14.x) (push) Waiting to run
yudao-ui-admin CI / build (16.x) (push) Waiting to run

This commit is contained in:
lxd 2024-07-24 17:17:21 +08:00
parent 4cdf0e9e4d
commit e9a46f6dfb
9 changed files with 504 additions and 0 deletions

View File

@ -0,0 +1,110 @@
package cn.iocoder.yudao.module.system.controller.admin.examitems;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.system.controller.admin.examitems.vo.*;
import cn.iocoder.yudao.module.system.dal.dataobject.examitems.examitemsDO;
import cn.iocoder.yudao.module.system.service.examitems.examitemsService;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
@Tag(name = "管理后台 - 检查部位")
@RestController
@RequestMapping("/examitems/examitems")
@Validated
public class examitemsController {
@Resource
private examitemsService examitemsService;
@PostMapping("/create")
@Operation(summary = "创建检查部位")
@PreAuthorize("@ss.hasPermission('examitems:examitems:create')")
public CommonResult<String> createexamitems(@Valid @RequestBody examitemsSaveReqVO createReqVO) {
UUID guid = UUID.randomUUID();
createReqVO.setId(guid.toString());
return success(examitemsService.createexamitems(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新检查部位")
@PreAuthorize("@ss.hasPermission('examitems:examitems:update')")
public CommonResult<Boolean> updateexamitems(@Valid @RequestBody examitemsSaveReqVO updateReqVO) {
examitemsService.updateexamitems(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除检查部位")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('examitems:examitems:delete')")
public CommonResult<Boolean> deleteexamitems(@RequestParam("id") String id,@RequestParam("username") String username) {
//当前时间
LocalDateTime dateTime= LocalDateTime.parse(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")),
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
examitemsSaveReqVO examitemsSaveReqVO=new examitemsSaveReqVO();
examitemsSaveReqVO.setId(id);
examitemsSaveReqVO.setIsdelete("1");
examitemsSaveReqVO.setDeleteDate(dateTime);
examitemsSaveReqVO.setDeletePerson(username);
examitemsService.updateexamitems(examitemsSaveReqVO);
// examitemsService.deleteexamitems(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得检查部位")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('examitems:examitems:query')")
public CommonResult<examitemsRespVO> getexamitems(@RequestParam("id") String id) {
examitemsDO examitems = examitemsService.getexamitems(id);
return success(BeanUtils.toBean(examitems, examitemsRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得检查部位分页")
@PreAuthorize("@ss.hasPermission('examitems:examitems:query')")
public CommonResult<PageResult<examitemsRespVO>> getexamitemsPage(@Valid examitemsPageReqVO pageReqVO) {
PageResult<examitemsDO> pageResult = examitemsService.getexamitemsPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, examitemsRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出检查部位 Excel")
@PreAuthorize("@ss.hasPermission('examitems:examitems:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportexamitemsExcel(@Valid examitemsPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<examitemsDO> list = examitemsService.getexamitemsPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "检查部位.xls", "数据", examitemsRespVO.class,
BeanUtils.toBean(list, examitemsRespVO.class));
}
}

View File

@ -0,0 +1,27 @@
package cn.iocoder.yudao.module.system.controller.admin.examitems.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 检查部位分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class examitemsPageReqVO extends PageParam {
@Schema(description = "检查项目", example = "王五")
private String examItemName;
@Schema(description = "检查项目代号")
private String examItemCode;
@Schema(description = "检查部位代码")
private String examPartCode;
}

View File

@ -0,0 +1,46 @@
package cn.iocoder.yudao.module.system.controller.admin.examitems.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.util.*;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 检查部位 Response VO")
@Data
@ExcelIgnoreUnannotated
public class examitemsRespVO {
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "19006")
@ExcelProperty("ID")
private String id;
@Schema(description = "检查项目", example = "王五")
@ExcelProperty("检查项目")
private String examItemName;
@Schema(description = "机构ID", example = "32037")
@ExcelProperty("机构ID")
private String orgId;
@Schema(description = "检查项目代号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("检查项目代号")
private String examItemCode;
@Schema(description = "检查部位代码")
@ExcelProperty("检查部位代码")
private String examPartCode;
@Schema(description = "第三方系统的检查项目的CODE")
@ExcelProperty("第三方系统的检查项目的CODE")
private String thirdPartyExamItemCode;
@Schema(description = "第三方系统的检查项目名称", example = "王五")
@ExcelProperty("第三方系统的检查项目名称")
private String thirdPartyExamItemName;
@Schema(description = "第三方系统的检查项目的收费价格", example = "5503")
@ExcelProperty("第三方系统的检查项目的收费价格")
private String thirdPartyExamItemPrice;
}

View File

@ -0,0 +1,52 @@
package cn.iocoder.yudao.module.system.controller.admin.examitems.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 检查部位新增/修改 Request VO")
@Data
public class examitemsSaveReqVO {
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "19006")
private String id;
@Schema(description = "检查项目", example = "王五")
private String examItemName;
@Schema(description = "创建时间")
private LocalDateTime createDate;
@Schema(description = "创建人")
private String createPerson;
@Schema(description = "删除标记:删除为 1 ")
private String isdelete;
@Schema(description = "机构ID", example = "32037")
private String orgId;
@Schema(description = "删除人")
private String deletePerson;
@Schema(description = "删除时间")
private LocalDateTime deleteDate;
@Schema(description = "检查项目代号", requiredMode = Schema.RequiredMode.REQUIRED)
private String examItemCode;
@Schema(description = "检查部位代码")
private String examPartCode;
@Schema(description = "第三方系统的检查项目的CODE")
private String thirdPartyExamItemCode;
@Schema(description = "第三方系统的检查项目名称", example = "王五")
private String thirdPartyExamItemName;
@Schema(description = "第三方系统的检查项目的收费价格", example = "5503")
private String thirdPartyExamItemPrice;
}

View File

@ -0,0 +1,91 @@
package cn.iocoder.yudao.module.system.dal.dataobject.examitems;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/**
* 检查部位 DO
*
* @author 李晓东
*/
@TableName("tb_examitems")
@KeySequence("tb_examitems_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class examitemsDO {
/**
* ID
*/
@TableId(type = IdType.INPUT)
private String id;
/**
* 检查项目
*/
@TableField("examItemName")
private String examItemName;
/**
* 创建时间
*/
@TableField("createDate")
private LocalDateTime createDate;
/**
* 创建人
*/
@TableField("createPerson")
private String createPerson;
/**
* 删除标记删除为 1
*/
@TableField("isdelete")
private String isdelete;
/**
* 机构ID
*/
@TableField("orgId")
private String orgId;
/**
* 删除人
*/
@TableField("deletePerson")
private String deletePerson;
/**
* 删除时间
*/
@TableField("deleteDate")
private LocalDateTime deleteDate;
/**
* 检查项目代号
*/
@TableField("examItemCode")
private String examItemCode;
/**
* 检查部位代码
*/
@TableField("examPartCode")
private String examPartCode;
/**
* 第三方系统的检查项目的CODE
*/
@TableField("thirdPartyExamItemCode")
private String thirdPartyExamItemCode;
/**
* 第三方系统的检查项目名称
*/
@TableField("thirdPartyExamItemName")
private String thirdPartyExamItemName;
/**
* 第三方系统的检查项目的收费价格
*/
@TableField("thirdPartyExamItemPrice")
private String thirdPartyExamItemPrice;
}

View File

@ -0,0 +1,33 @@
package cn.iocoder.yudao.module.system.dal.mysql.examitems;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.system.dal.dataobject.doctor.DoctorDO;
import cn.iocoder.yudao.module.system.dal.dataobject.examitems.examitemsDO;
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.system.controller.admin.examitems.vo.*;
/**
* 检查部位 Mapper
*
* @author 李晓东
*/
@InterceptorIgnore(tenantLine = "true")
@Mapper
public interface examitemsMapper extends BaseMapperX<examitemsDO> {
default PageResult<examitemsDO> selectPage(examitemsPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<examitemsDO>()
.likeIfPresent(examitemsDO::getExamItemName, reqVO.getExamItemName())
.likeIfPresent(examitemsDO::getExamItemCode, reqVO.getExamItemCode())
.likeIfPresent(examitemsDO::getExamPartCode, reqVO.getExamPartCode())
.or(wrapper -> wrapper.eq(examitemsDO::getIsdelete, 0))
.or(wrapper -> wrapper.isNull(examitemsDO::getIsdelete))
.orderByDesc(examitemsDO::getId));
}
}

View File

@ -0,0 +1,56 @@
package cn.iocoder.yudao.module.system.service.examitems;
import java.util.*;
import cn.iocoder.yudao.module.system.controller.admin.examitems.vo.*;
import cn.iocoder.yudao.module.system.dal.dataobject.examitems.examitemsDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import javax.validation.Valid;
/**
* 检查部位 Service 接口
*
* @author 李晓东
*/
public interface examitemsService {
/**
* 创建检查部位
*
* @param createReqVO 创建信息
* @return 编号
*/
String createexamitems(@Valid examitemsSaveReqVO createReqVO);
/**
* 更新检查部位
*
* @param updateReqVO 更新信息
*/
void updateexamitems(@Valid examitemsSaveReqVO updateReqVO);
/**
* 删除检查部位
*
* @param id 编号
*/
void deleteexamitems(String id);
/**
* 获得检查部位
*
* @param id 编号
* @return 检查部位
*/
examitemsDO getexamitems(String id);
/**
* 获得检查部位分页
*
* @param pageReqVO 分页查询
* @return 检查部位分页
*/
PageResult<examitemsDO> getexamitemsPage(examitemsPageReqVO pageReqVO);
}

View File

@ -0,0 +1,77 @@
package cn.iocoder.yudao.module.system.service.examitems;
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import cn.iocoder.yudao.module.system.controller.admin.examitems.vo.*;
import cn.iocoder.yudao.module.system.dal.dataobject.examitems.examitemsDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.system.dal.mysql.examitems.examitemsMapper;
import javax.annotation.Resource;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
/**
* 检查部位 Service 实现类
*
* @author 李晓东
*/
@Service
@Validated
public class examitemsServiceImpl implements examitemsService {
@Resource
private examitemsMapper examitemsMapper;
@Override
public String createexamitems(examitemsSaveReqVO createReqVO) {
// 插入
examitemsDO examitems = BeanUtils.toBean(createReqVO, examitemsDO.class);
examitemsMapper.insert(examitems);
// 返回
return examitems.getId();
}
@Override
public void updateexamitems(examitemsSaveReqVO updateReqVO) {
// 校验存在
validateexamitemsExists(updateReqVO.getId());
// 更新
examitemsDO updateObj = BeanUtils.toBean(updateReqVO, examitemsDO.class);
examitemsMapper.updateById(updateObj);
}
@Override
public void deleteexamitems(String id) {
// 校验存在
validateexamitemsExists(id);
// 删除
examitemsMapper.deleteById(id);
}
private void validateexamitemsExists(String id) {
if (examitemsMapper.selectById(id) == null) {
throw exception(new ErrorCode(1,"ID不存在"));
}
}
@Override
public examitemsDO getexamitems(String id) {
return examitemsMapper.selectById(id);
}
@Override
public PageResult<examitemsDO> getexamitemsPage(examitemsPageReqVO pageReqVO) {
return examitemsMapper.selectPage(pageReqVO);
}
}

View File

@ -0,0 +1,12 @@
<?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="cn.iocoder.yudao.module.system.dal.mysql.examitems.examitemsMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>