diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/patientinfo/patientinfoController.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/patientinfo/patientinfoController.java new file mode 100644 index 0000000..5e50c73 --- /dev/null +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/patientinfo/patientinfoController.java @@ -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 createpatientinfo(@Valid @RequestBody patientinfoSaveReqVO createReqVO) { + return success(patientinfoService.createpatientinfo(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新人员信息表(患者信息表)") + public CommonResult updatepatientinfo(@Valid @RequestBody patientinfoSaveReqVO updateReqVO) { + patientinfoService.updatepatientinfo(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除人员信息表(患者信息表)") + @Parameter(name = "id", description = "编号", required = true) + public CommonResult deletepatientinfo(@RequestParam("id") Integer id) { + patientinfoService.deletepatientinfo(id); + return success(true); + } + + @DeleteMapping("/delete-list") + @Parameter(name = "ids", description = "编号", required = true) + @Operation(summary = "批量删除人员信息表(患者信息表)") + public CommonResult deletepatientinfoList(@RequestParam("ids") List ids) { + patientinfoService.deletepatientinfoListByIds(ids); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得人员信息表(患者信息表)") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + public CommonResult getpatientinfo(@RequestParam("id") Integer id) { + patientinfoDO patientinfo = patientinfoService.getpatientinfo(id); + return success(BeanUtils.toBean(patientinfo, patientinfoRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得人员信息表(患者信息表)分页") + public CommonResult> getpatientinfoPage(@Valid patientinfoPageReqVO pageReqVO) { + PageResult 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 list = patientinfoService.getpatientinfoPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "人员信息表(患者信息表).xls", "数据", patientinfoRespVO.class, + BeanUtils.toBean(list, patientinfoRespVO.class)); + } + +} \ No newline at end of file diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/patientinfo/vo/patientinfoPageReqVO.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/patientinfo/vo/patientinfoPageReqVO.java new file mode 100644 index 0000000..ce58568 --- /dev/null +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/patientinfo/vo/patientinfoPageReqVO.java @@ -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; + +} \ No newline at end of file diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/patientinfo/vo/patientinfoRespVO.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/patientinfo/vo/patientinfoRespVO.java new file mode 100644 index 0000000..f1527f9 --- /dev/null +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/patientinfo/vo/patientinfoRespVO.java @@ -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; + +} \ No newline at end of file diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/patientinfo/vo/patientinfoSaveReqVO.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/patientinfo/vo/patientinfoSaveReqVO.java new file mode 100644 index 0000000..9ac74ff --- /dev/null +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/patientinfo/vo/patientinfoSaveReqVO.java @@ -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; + +} \ No newline at end of file diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/patientinfo/patientinfoDO.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/patientinfo/patientinfoDO.java new file mode 100644 index 0000000..81204a5 --- /dev/null +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/patientinfo/patientinfoDO.java @@ -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") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 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; + + +} \ No newline at end of file diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/patientinfo/patientinfoMapper.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/patientinfo/patientinfoMapper.java new file mode 100644 index 0000000..2f9f478 --- /dev/null +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/patientinfo/patientinfoMapper.java @@ -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 { + + default PageResult selectPage(patientinfoPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .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)); + } + +} \ No newline at end of file diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/patientinfo/patientinfoService.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/patientinfo/patientinfoService.java new file mode 100644 index 0000000..4cd69a2 --- /dev/null +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/patientinfo/patientinfoService.java @@ -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 ids); + + /** + * 获得人员信息表(患者信息表) + * + * @param id 编号 + * @return 人员信息表(患者信息表) + */ + patientinfoDO getpatientinfo(Integer id); + + /** + * 获得人员信息表(患者信息表)分页 + * + * @param pageReqVO 分页查询 + * @return 人员信息表(患者信息表)分页 + */ + PageResult getpatientinfoPage(patientinfoPageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/patientinfo/patientinfoServiceImpl.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/patientinfo/patientinfoServiceImpl.java new file mode 100644 index 0000000..6a99f26 --- /dev/null +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/patientinfo/patientinfoServiceImpl.java @@ -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 ids) { + // 校验存在 + validatepatientinfoExists(ids); + // 删除 + patientinfoMapper.deleteByIds(ids); + } + + private void validatepatientinfoExists(List ids) { + List 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 getpatientinfoPage(patientinfoPageReqVO pageReqVO) { + return patientinfoMapper.selectPage(pageReqVO); + } + +} \ No newline at end of file diff --git a/yudao-module-system/src/main/resources/mapper/patientinfo/patientinfoMapper.xml b/yudao-module-system/src/main/resources/mapper/patientinfo/patientinfoMapper.xml new file mode 100644 index 0000000..87d5fef --- /dev/null +++ b/yudao-module-system/src/main/resources/mapper/patientinfo/patientinfoMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file