添加基础信息

This commit is contained in:
Flow 2025-07-14 11:12:09 +08:00
parent e4febe20e1
commit 2757eb41f6
9 changed files with 574 additions and 0 deletions

View File

@ -0,0 +1,97 @@
package cn.iocoder.yudao.module.system.controller.admin.patientinfo;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
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 javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
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.patientinfo.vo.*;
import cn.iocoder.yudao.module.system.dal.dataobject.patientinfo.patientinfoDO;
import cn.iocoder.yudao.module.system.service.patientinfo.patientinfoService;
@Tag(name = "管理后台 - 人员信息表(患者信息表)")
@RestController
@RequestMapping("/system/patientinfo")
@Validated
public class patientinfoController {
@Resource
private patientinfoService patientinfoService;
@PostMapping("/create")
@Operation(summary = "创建人员信息表(患者信息表)")
public CommonResult<Integer> createpatientinfo(@Valid @RequestBody patientinfoSaveReqVO createReqVO) {
return success(patientinfoService.createpatientinfo(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新人员信息表(患者信息表)")
public CommonResult<Boolean> updatepatientinfo(@Valid @RequestBody patientinfoSaveReqVO updateReqVO) {
patientinfoService.updatepatientinfo(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除人员信息表(患者信息表)")
@Parameter(name = "id", description = "编号", required = true)
public CommonResult<Boolean> deletepatientinfo(@RequestParam("id") Integer id) {
patientinfoService.deletepatientinfo(id);
return success(true);
}
@DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除人员信息表(患者信息表)")
public CommonResult<Boolean> deletepatientinfoList(@RequestParam("ids") List<Integer> ids) {
patientinfoService.deletepatientinfoListByIds(ids);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得人员信息表(患者信息表)")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
public CommonResult<patientinfoRespVO> getpatientinfo(@RequestParam("id") Integer id) {
patientinfoDO patientinfo = patientinfoService.getpatientinfo(id);
return success(BeanUtils.toBean(patientinfo, patientinfoRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得人员信息表(患者信息表)分页")
public CommonResult<PageResult<patientinfoRespVO>> getpatientinfoPage(@Valid patientinfoPageReqVO pageReqVO) {
PageResult<patientinfoDO> pageResult = patientinfoService.getpatientinfoPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, patientinfoRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出人员信息表(患者信息表) Excel")
@ApiAccessLog(operateType = EXPORT)
public void exportpatientinfoExcel(@Valid patientinfoPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<patientinfoDO> list = patientinfoService.getpatientinfoPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "人员信息表(患者信息表).xls", "数据", patientinfoRespVO.class,
BeanUtils.toBean(list, patientinfoRespVO.class));
}
}

View File

@ -0,0 +1,57 @@
package cn.iocoder.yudao.module.system.controller.admin.patientinfo.vo;
import lombok.*;
import java.time.LocalDate;
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
public class patientinfoPageReqVO extends PageParam {
@Schema(description = "患者姓名", example = "王五")
private String name;
@Schema(description = "身份证号")
private String idcard;
@Schema(description = "注册ID", example = "26051")
private String regid;
@Schema(description = "机构ID", example = "2261")
private String orgid;
@Schema(description = "机构名称", example = "芋艿")
private String orgname;
@Schema(description = "手机号")
private String phone;
@Schema(description = "性别0-未知1-男2-女")
private Integer gender;
@Schema(description = "出生日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDate[] birthdate;
@Schema(description = "地址")
private String address;
@Schema(description = "状态0-禁用1-启用", example = "1")
private Integer status;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createtime;
@Schema(description = "更新时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] updatetime;
}

View File

@ -0,0 +1,69 @@
package cn.iocoder.yudao.module.system.controller.admin.patientinfo.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.time.LocalDate;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 人员信息表(患者信息表) Response VO")
@Data
@ExcelIgnoreUnannotated
public class patientinfoRespVO {
@Schema(description = "主键ID自增", requiredMode = Schema.RequiredMode.REQUIRED, example = "30076")
@ExcelProperty("主键ID自增")
private Integer id;
@Schema(description = "患者姓名", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
@ExcelProperty("患者姓名")
private String name;
@Schema(description = "身份证号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("身份证号")
private String idcard;
@Schema(description = "注册ID", example = "26051")
@ExcelProperty("注册ID")
private String regid;
@Schema(description = "机构ID", example = "2261")
@ExcelProperty("机构ID")
private String orgid;
@Schema(description = "机构名称", example = "芋艿")
@ExcelProperty("机构名称")
private String orgname;
@Schema(description = "手机号")
@ExcelProperty("手机号")
private String phone;
@Schema(description = "性别0-未知1-男2-女")
@ExcelProperty("性别0-未知1-男2-女")
private Integer gender;
@Schema(description = "出生日期")
@ExcelProperty("出生日期")
private LocalDate birthdate;
@Schema(description = "地址")
@ExcelProperty("地址")
private String address;
@Schema(description = "状态0-禁用1-启用", example = "1")
@ExcelProperty("状态0-禁用1-启用")
private Integer status;
@Schema(description = "创建时间")
@ExcelProperty("创建时间")
private LocalDateTime createtime;
@Schema(description = "更新时间")
@ExcelProperty("更新时间")
private LocalDateTime updatetime;
}

View File

@ -0,0 +1,57 @@
package cn.iocoder.yudao.module.system.controller.admin.patientinfo.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.time.LocalDate;
import java.util.*;
import javax.validation.constraints.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 人员信息表(患者信息表)新增/修改 Request VO")
@Data
public class patientinfoSaveReqVO {
@Schema(description = "主键ID自增", requiredMode = Schema.RequiredMode.REQUIRED, example = "30076")
private Integer id;
@Schema(description = "患者姓名", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
@NotEmpty(message = "患者姓名不能为空")
private String name;
@Schema(description = "身份证号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "身份证号不能为空")
private String idcard;
@Schema(description = "注册ID", example = "26051")
private String regid;
@Schema(description = "机构ID", example = "2261")
private String orgid;
@Schema(description = "机构名称", example = "芋艿")
private String orgname;
@Schema(description = "手机号")
private String phone;
@Schema(description = "性别0-未知1-男2-女")
private Integer gender;
@Schema(description = "出生日期")
private LocalDate birthdate;
@Schema(description = "地址")
private String address;
@Schema(description = "状态0-禁用1-启用", example = "1")
private Integer status;
@Schema(description = "创建时间")
private LocalDateTime createtime;
@Schema(description = "更新时间")
private LocalDateTime updatetime;
}

View File

@ -0,0 +1,93 @@
package cn.iocoder.yudao.module.system.dal.dataobject.patientinfo;
import lombok.*;
import java.time.LocalDate;
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("patientinfo")
@KeySequence("patientinfo_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class patientinfoDO{
/**
* 主键ID自增
*/
@TableId
private Integer id;
/**
* 患者姓名
*/
@TableField("name")
private String name;
/**
* 身份证号
*/
@TableField("idcard")
private String idcard;
/**
* 注册ID
*/
@TableField("regid")
private String regid;
/**
* 机构ID
*/
@TableField("orgid")
private String orgid;
/**
* 机构名称
*/
@TableField("orgname")
private String orgname;
/**
* 手机号
*/
@TableField("phone")
private String phone;
/**
* 性别0-未知1-2-
*/
@TableField("gender")
private Integer gender;
/**
* 出生日期
*/
@TableField("birthdate")
private LocalDate birthdate;
/**
* 地址
*/
@TableField("address")
private String address;
/**
* 状态0-禁用1-启用
*/
@TableField("status")
private Integer status;
/**
* 创建时间
*/
@TableField("createtime")
private LocalDateTime createtime;
/**
* 更新时间
*/
@TableField("updatetime")
private LocalDateTime updatetime;
}

View File

@ -0,0 +1,37 @@
package cn.iocoder.yudao.module.system.dal.mysql.patientinfo;
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.patientinfo.patientinfoDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.system.controller.admin.patientinfo.vo.*;
/**
* 人员信息表患者信息表 Mapper
*
* @author 艾康菲
*/
@Mapper
public interface patientinfoMapper extends BaseMapperX<patientinfoDO> {
default PageResult<patientinfoDO> selectPage(patientinfoPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<patientinfoDO>()
.likeIfPresent(patientinfoDO::getName, reqVO.getName())
.eqIfPresent(patientinfoDO::getIdcard, reqVO.getIdcard())
.eqIfPresent(patientinfoDO::getRegid, reqVO.getRegid())
.eqIfPresent(patientinfoDO::getOrgid, reqVO.getOrgid())
.likeIfPresent(patientinfoDO::getOrgname, reqVO.getOrgname())
.eqIfPresent(patientinfoDO::getPhone, reqVO.getPhone())
.eqIfPresent(patientinfoDO::getGender, reqVO.getGender())
.betweenIfPresent(patientinfoDO::getBirthdate, reqVO.getBirthdate())
.eqIfPresent(patientinfoDO::getAddress, reqVO.getAddress())
.eqIfPresent(patientinfoDO::getStatus, reqVO.getStatus())
.betweenIfPresent(patientinfoDO::getCreatetime, reqVO.getCreatetime())
.betweenIfPresent(patientinfoDO::getUpdatetime, reqVO.getUpdatetime())
.orderByDesc(patientinfoDO::getId));
}
}

View File

@ -0,0 +1,62 @@
package cn.iocoder.yudao.module.system.service.patientinfo;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.module.system.controller.admin.patientinfo.vo.*;
import cn.iocoder.yudao.module.system.dal.dataobject.patientinfo.patientinfoDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
/**
* 人员信息表患者信息表 Service 接口
*
* @author 艾康菲
*/
public interface patientinfoService {
/**
* 创建人员信息表患者信息表
*
* @param createReqVO 创建信息
* @return 编号
*/
Integer createpatientinfo(@Valid patientinfoSaveReqVO createReqVO);
/**
* 更新人员信息表患者信息表
*
* @param updateReqVO 更新信息
*/
void updatepatientinfo(@Valid patientinfoSaveReqVO updateReqVO);
/**
* 删除人员信息表患者信息表
*
* @param id 编号
*/
void deletepatientinfo(Integer id);
/**
* 批量删除人员信息表患者信息表
*
* @param ids 编号
*/
void deletepatientinfoListByIds(List<Integer> ids);
/**
* 获得人员信息表患者信息表
*
* @param id 编号
* @return 人员信息表患者信息表
*/
patientinfoDO getpatientinfo(Integer id);
/**
* 获得人员信息表患者信息表分页
*
* @param pageReqVO 分页查询
* @return 人员信息表患者信息表分页
*/
PageResult<patientinfoDO> getpatientinfoPage(patientinfoPageReqVO pageReqVO);
}

View File

@ -0,0 +1,90 @@
package cn.iocoder.yudao.module.system.service.patientinfo;
import cn.hutool.core.collection.CollUtil;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import cn.iocoder.yudao.module.system.controller.admin.patientinfo.vo.*;
import cn.iocoder.yudao.module.system.dal.dataobject.patientinfo.patientinfoDO;
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.patientinfo.patientinfoMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.diffList;
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
/**
* 人员信息表患者信息表 Service 实现类
*
* @author 艾康菲
*/
@Service
@Validated
public class patientinfoServiceImpl implements patientinfoService {
@Resource
private patientinfoMapper patientinfoMapper;
@Override
public Integer createpatientinfo(patientinfoSaveReqVO createReqVO) {
// 插入
patientinfoDO patientinfo = BeanUtils.toBean(createReqVO, patientinfoDO.class);
patientinfoMapper.insert(patientinfo);
// 返回
return patientinfo.getId();
}
@Override
public void updatepatientinfo(patientinfoSaveReqVO updateReqVO) {
// 校验存在
validatepatientinfoExists(updateReqVO.getId());
// 更新
patientinfoDO updateObj = BeanUtils.toBean(updateReqVO, patientinfoDO.class);
patientinfoMapper.updateById(updateObj);
}
@Override
public void deletepatientinfo(Integer id) {
// 校验存在
validatepatientinfoExists(id);
// 删除
patientinfoMapper.deleteById(id);
}
@Override
public void deletepatientinfoListByIds(List<Integer> ids) {
// 校验存在
validatepatientinfoExists(ids);
// 删除
patientinfoMapper.deleteByIds(ids);
}
private void validatepatientinfoExists(List<Integer> ids) {
List<patientinfoDO> list = patientinfoMapper.selectByIds(ids);
if (CollUtil.isEmpty(list) || list.size() != ids.size()) {
}
}
private void validatepatientinfoExists(Integer id) {
if (patientinfoMapper.selectById(id) == null) {
}
}
@Override
public patientinfoDO getpatientinfo(Integer id) {
return patientinfoMapper.selectById(id);
}
@Override
public PageResult<patientinfoDO> getpatientinfoPage(patientinfoPageReqVO pageReqVO) {
return patientinfoMapper.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.patientinfo.patientinfoMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>