From e9a46f6dfbd7b23f8c246cc4452073b915a934c0 Mon Sep 17 00:00:00 2001 From: lxd <1004405501@qq.com> Date: Wed, 24 Jul 2024 17:17:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=A3=80=E6=9F=A5=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E6=A8=A1=E5=9D=97=20=E5=B0=8F=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/examitems/examitemsController.java | 110 ++++++++++++++++++ .../examitems/vo/examitemsPageReqVO.java | 27 +++++ .../admin/examitems/vo/examitemsRespVO.java | 46 ++++++++ .../examitems/vo/examitemsSaveReqVO.java | 52 +++++++++ .../dal/dataobject/examitems/examitemsDO.java | 91 +++++++++++++++ .../dal/mysql/examitems/examitemsMapper.java | 33 ++++++ .../service/examitems/examitemsService.java | 56 +++++++++ .../examitems/examitemsServiceImpl.java | 77 ++++++++++++ .../resources/examitems/examitemsMapper.xml | 12 ++ 9 files changed, 504 insertions(+) create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/examitems/examitemsController.java create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/examitems/vo/examitemsPageReqVO.java create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/examitems/vo/examitemsRespVO.java create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/examitems/vo/examitemsSaveReqVO.java create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/examitems/examitemsDO.java create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/examitems/examitemsMapper.java create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/examitems/examitemsService.java create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/examitems/examitemsServiceImpl.java create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/resources/examitems/examitemsMapper.xml diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/examitems/examitemsController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/examitems/examitemsController.java new file mode 100644 index 000000000..7d0f12dde --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/examitems/examitemsController.java @@ -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 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 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 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 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> getexamitemsPage(@Valid examitemsPageReqVO pageReqVO) { + PageResult 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 list = examitemsService.getexamitemsPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "检查部位.xls", "数据", examitemsRespVO.class, + BeanUtils.toBean(list, examitemsRespVO.class)); + } + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/examitems/vo/examitemsPageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/examitems/vo/examitemsPageReqVO.java new file mode 100644 index 000000000..10891b3c6 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/examitems/vo/examitemsPageReqVO.java @@ -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; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/examitems/vo/examitemsRespVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/examitems/vo/examitemsRespVO.java new file mode 100644 index 000000000..f2dc47e6f --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/examitems/vo/examitemsRespVO.java @@ -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; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/examitems/vo/examitemsSaveReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/examitems/vo/examitemsSaveReqVO.java new file mode 100644 index 000000000..beb7d7b61 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/examitems/vo/examitemsSaveReqVO.java @@ -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; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/examitems/examitemsDO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/examitems/examitemsDO.java new file mode 100644 index 000000000..fd3008666 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/examitems/examitemsDO.java @@ -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") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 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; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/examitems/examitemsMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/examitems/examitemsMapper.java new file mode 100644 index 000000000..8d3838772 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/examitems/examitemsMapper.java @@ -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 { + + default PageResult selectPage(examitemsPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .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)); + } + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/examitems/examitemsService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/examitems/examitemsService.java new file mode 100644 index 000000000..ef0bc9c3c --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/examitems/examitemsService.java @@ -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 getexamitemsPage(examitemsPageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/examitems/examitemsServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/examitems/examitemsServiceImpl.java new file mode 100644 index 000000000..84ca90a9f --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/examitems/examitemsServiceImpl.java @@ -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 getexamitemsPage(examitemsPageReqVO pageReqVO) { + return examitemsMapper.selectPage(pageReqVO); + } + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/resources/examitems/examitemsMapper.xml b/yudao-module-system/yudao-module-system-biz/src/main/resources/examitems/examitemsMapper.xml new file mode 100644 index 000000000..2cef3df23 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/resources/examitems/examitemsMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file