From 7aa925393ffd2bb2b5543f7a733b9fa317b12d52 Mon Sep 17 00:00:00 2001 From: Flow <958079825@qq.com> Date: Fri, 25 Jul 2025 16:36:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8C=BB=E7=94=9F=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/doctor/DoctorController.java | 105 ++++++++++++++++++ .../admin/doctor/vo/DoctorPageReqVO.java | 27 +++++ .../admin/doctor/vo/DoctorRespVO.java | 37 ++++++ .../admin/doctor/vo/DoctorSaveReqVO.java | 30 +++++ .../dal/dataobject/doctor/DoctorDO.java | 54 +++++++++ .../system/dal/mysql/doctor/DoctorMapper.java | 30 +++++ .../system/service/doctor/DoctorService.java | 69 ++++++++++++ .../service/doctor/DoctorServiceImpl.java | 95 ++++++++++++++++ .../resources/mapper/doctor/DoctorMapper.xml | 12 ++ .../src/main/resources/application.yaml | 1 + 10 files changed, 460 insertions(+) create mode 100644 yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/doctor/DoctorController.java create mode 100644 yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/doctor/vo/DoctorPageReqVO.java create mode 100644 yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/doctor/vo/DoctorRespVO.java create mode 100644 yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/doctor/vo/DoctorSaveReqVO.java create mode 100644 yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/doctor/DoctorDO.java create mode 100644 yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/doctor/DoctorMapper.java create mode 100644 yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/doctor/DoctorService.java create mode 100644 yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/doctor/DoctorServiceImpl.java create mode 100644 yudao-module-system/src/main/resources/mapper/doctor/DoctorMapper.xml diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/doctor/DoctorController.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/doctor/DoctorController.java new file mode 100644 index 0000000..bc01e79 --- /dev/null +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/doctor/DoctorController.java @@ -0,0 +1,105 @@ +package cn.iocoder.yudao.module.system.controller.admin.doctor; + +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.doctor.vo.*; +import cn.iocoder.yudao.module.system.dal.dataobject.doctor.DoctorDO; +import cn.iocoder.yudao.module.system.service.doctor.DoctorService; + +@Tag(name = "管理后台 - 保存医生签名信息") +@RestController +@RequestMapping("/system/doctor") +@Validated +public class DoctorController { + + @Resource + private DoctorService doctorService; + + @PostMapping("/create") + @Operation(summary = "创建保存医生签名信息") + public CommonResult createDoctor(@Valid @RequestBody DoctorSaveReqVO createReqVO) { + return success(doctorService.createDoctor(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新保存医生签名信息") + public CommonResult updateDoctor(@Valid @RequestBody DoctorSaveReqVO updateReqVO) { + doctorService.updateDoctor(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除保存医生签名信息") + @Parameter(name = "id", description = "编号", required = true) + public CommonResult deleteDoctor(@RequestParam("id") Integer id) { + doctorService.deleteDoctor(id); + return success(true); + } + + @DeleteMapping("/delete-list") + @Parameter(name = "ids", description = "编号", required = true) + @Operation(summary = "批量删除保存医生签名信息") + public CommonResult deleteDoctorList(@RequestParam("ids") List ids) { + doctorService.deleteDoctorListByIds(ids); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得保存医生签名信息") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + public CommonResult getDoctor(@RequestParam("id") Integer id) { + DoctorDO doctor = doctorService.getDoctor(id); + return success(BeanUtils.toBean(doctor, DoctorRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得保存医生签名信息分页") + public CommonResult> getDoctorPage(@Valid DoctorPageReqVO pageReqVO) { + PageResult pageResult = doctorService.getDoctorPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, DoctorRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出保存医生签名信息 Excel") + @ApiAccessLog(operateType = EXPORT) + public void exportDoctorExcel(@Valid DoctorPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = doctorService.getDoctorPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "保存医生签名信息.xls", "数据", DoctorRespVO.class, + BeanUtils.toBean(list, DoctorRespVO.class)); + } + + @GetMapping("/getDoctorByDoctorId") + @Operation(summary = "根据医生ID查询医生信息") + @Parameter(name = "doctorid", description = "医生ID", required = true, example = "123") + public CommonResult getDoctorByDoctorId(@RequestParam("doctorid") String doctorid) { + DoctorDO doctor = doctorService.getDoctorByDoctorId(doctorid); + return success(BeanUtils.toBean(doctor, DoctorRespVO.class)); + } + +} \ No newline at end of file diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/doctor/vo/DoctorPageReqVO.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/doctor/vo/DoctorPageReqVO.java new file mode 100644 index 0000000..7f05e1b --- /dev/null +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/doctor/vo/DoctorPageReqVO.java @@ -0,0 +1,27 @@ +package cn.iocoder.yudao.module.system.controller.admin.doctor.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; + +@Schema(description = "管理后台 - 保存医生签名信息分页 Request VO") +@Data +public class DoctorPageReqVO extends PageParam { + + @Schema(description = "医生编号", example = "1873") + private String doctorid; + + @Schema(description = "医生姓名", example = "李四") + private String doctorname; + + @Schema(description = "医生签名图片") + private String doctorsign; + + @Schema(description = "机构ID", example = "32300") + private String orgid; + + @Schema(description = "机构名称", example = "李四") + private String orgname; + +} \ No newline at end of file diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/doctor/vo/DoctorRespVO.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/doctor/vo/DoctorRespVO.java new file mode 100644 index 0000000..61d33b3 --- /dev/null +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/doctor/vo/DoctorRespVO.java @@ -0,0 +1,37 @@ +package cn.iocoder.yudao.module.system.controller.admin.doctor.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import com.alibaba.excel.annotation.*; + +@Schema(description = "管理后台 - 保存医生签名信息 Response VO") +@Data +@ExcelIgnoreUnannotated +public class DoctorRespVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "7050") + @ExcelProperty("主键") + private Integer id; + + @Schema(description = "医生编号", example = "1873") + @ExcelProperty("医生编号") + private String doctorid; + + @Schema(description = "医生姓名", example = "李四") + @ExcelProperty("医生姓名") + private String doctorname; + + @Schema(description = "医生签名图片") + @ExcelProperty("医生签名图片") + private String doctorsign; + + @Schema(description = "机构ID", example = "32300") + @ExcelProperty("机构ID") + private String orgid; + + @Schema(description = "机构名称", example = "李四") + @ExcelProperty("机构名称") + private String orgname; + +} \ No newline at end of file diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/doctor/vo/DoctorSaveReqVO.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/doctor/vo/DoctorSaveReqVO.java new file mode 100644 index 0000000..3b00da2 --- /dev/null +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/doctor/vo/DoctorSaveReqVO.java @@ -0,0 +1,30 @@ +package cn.iocoder.yudao.module.system.controller.admin.doctor.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import javax.validation.constraints.*; + +@Schema(description = "管理后台 - 保存医生签名信息新增/修改 Request VO") +@Data +public class DoctorSaveReqVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "7050") + private Integer id; + + @Schema(description = "医生编号", example = "1873") + private String doctorid; + + @Schema(description = "医生姓名", example = "李四") + private String doctorname; + + @Schema(description = "医生签名图片") + private String doctorsign; + + @Schema(description = "机构ID", example = "32300") + private String orgid; + + @Schema(description = "机构名称", example = "李四") + private String orgname; + +} \ No newline at end of file diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/doctor/DoctorDO.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/doctor/DoctorDO.java new file mode 100644 index 0000000..bde1564 --- /dev/null +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/doctor/DoctorDO.java @@ -0,0 +1,54 @@ +package cn.iocoder.yudao.module.system.dal.dataobject.doctor; + +import lombok.*; +import java.util.*; +import com.baomidou.mybatisplus.annotation.*; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; + +/** + * 保存医生签名信息 DO + * + * @author 艾康菲 + */ +@TableName("tb_doctor") +@KeySequence("tb_doctor_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class DoctorDO{ + + /** + * 主键 + */ + @TableId + private Integer id; + /** + * 医生编号 + */ + @TableField("doctorid") + private String doctorid; + /** + * 医生姓名 + */ + @TableField("doctorname") + private String doctorname; + /** + * 医生签名图片 + */ + @TableField("doctorsign") + private String doctorsign; + /** + * 机构ID + */ + @TableField("orgid") + private String orgid; + /** + * 机构名称 + */ + @TableField("orgname") + private String orgname; + + +} \ No newline at end of file diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/doctor/DoctorMapper.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/doctor/DoctorMapper.java new file mode 100644 index 0000000..d063025 --- /dev/null +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/doctor/DoctorMapper.java @@ -0,0 +1,30 @@ +package cn.iocoder.yudao.module.system.dal.mysql.doctor; + +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 org.apache.ibatis.annotations.Mapper; +import cn.iocoder.yudao.module.system.controller.admin.doctor.vo.*; + +/** + * 保存医生签名信息 Mapper + * + * @author 艾康菲 + */ +@Mapper +public interface DoctorMapper extends BaseMapperX { + + default PageResult selectPage(DoctorPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(DoctorDO::getDoctorid, reqVO.getDoctorid()) + .likeIfPresent(DoctorDO::getDoctorname, reqVO.getDoctorname()) + .eqIfPresent(DoctorDO::getDoctorsign, reqVO.getDoctorsign()) + .eqIfPresent(DoctorDO::getOrgid, reqVO.getOrgid()) + .likeIfPresent(DoctorDO::getOrgname, reqVO.getOrgname()) + .orderByDesc(DoctorDO::getId)); + } + +} \ No newline at end of file diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/doctor/DoctorService.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/doctor/DoctorService.java new file mode 100644 index 0000000..9b60ddb --- /dev/null +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/doctor/DoctorService.java @@ -0,0 +1,69 @@ +package cn.iocoder.yudao.module.system.service.doctor; + +import java.util.*; +import javax.validation.*; +import cn.iocoder.yudao.module.system.controller.admin.doctor.vo.*; +import cn.iocoder.yudao.module.system.dal.dataobject.doctor.DoctorDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; + +/** + * 保存医生签名信息 Service 接口 + * + * @author 艾康菲 + */ +public interface DoctorService { + + /** + * 创建保存医生签名信息 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Integer createDoctor(@Valid DoctorSaveReqVO createReqVO); + + /** + * 更新保存医生签名信息 + * + * @param updateReqVO 更新信息 + */ + void updateDoctor(@Valid DoctorSaveReqVO updateReqVO); + + /** + * 删除保存医生签名信息 + * + * @param id 编号 + */ + void deleteDoctor(Integer id); + + /** + * 批量删除保存医生签名信息 + * + * @param ids 编号 + */ + void deleteDoctorListByIds(List ids); + + /** + * 获得保存医生签名信息 + * + * @param id 编号 + * @return 保存医生签名信息 + */ + DoctorDO getDoctor(Integer id); + + /** + * 根据医生doctorid查询医生信息 + * @param doctorid 医生编号 + * @return 医生信息 + */ + DoctorDO getDoctorByDoctorId(String doctorid); + + /** + * 获得保存医生签名信息分页 + * + * @param pageReqVO 分页查询 + * @return 保存医生签名信息分页 + */ + PageResult getDoctorPage(DoctorPageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/doctor/DoctorServiceImpl.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/doctor/DoctorServiceImpl.java new file mode 100644 index 0000000..0744938 --- /dev/null +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/doctor/DoctorServiceImpl.java @@ -0,0 +1,95 @@ +package cn.iocoder.yudao.module.system.service.doctor; + +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.doctor.vo.*; +import cn.iocoder.yudao.module.system.dal.dataobject.doctor.DoctorDO; +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.doctor.DoctorMapper; + +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.*; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; + +/** + * 保存医生签名信息 Service 实现类 + * + * @author 艾康菲 + */ +@Service +@Validated +public class DoctorServiceImpl implements DoctorService { + + @Resource + private DoctorMapper doctorMapper; + + @Override + public Integer createDoctor(DoctorSaveReqVO createReqVO) { + // 插入 + DoctorDO doctor = BeanUtils.toBean(createReqVO, DoctorDO.class); + doctorMapper.insert(doctor); + // 返回 + return doctor.getId(); + } + + @Override + public void updateDoctor(DoctorSaveReqVO updateReqVO) { + // 校验存在 + validateDoctorExists(updateReqVO.getId()); + // 更新 + DoctorDO updateObj = BeanUtils.toBean(updateReqVO, DoctorDO.class); + doctorMapper.updateById(updateObj); + } + + @Override + public void deleteDoctor(Integer id) { + // 校验存在 + validateDoctorExists(id); + // 删除 + doctorMapper.deleteById(id); + } + + @Override + public void deleteDoctorListByIds(List ids) { + // 校验存在 + validateDoctorExists(ids); + // 删除 + doctorMapper.deleteByIds(ids); + } + + private void validateDoctorExists(List ids) { + List list = doctorMapper.selectByIds(ids); + if (CollUtil.isEmpty(list) || list.size() != ids.size()) { + } + } + + private void validateDoctorExists(Integer id) { + if (doctorMapper.selectById(id) == null) { + } + } + + @Override + public DoctorDO getDoctor(Integer id) { + return doctorMapper.selectById(id); + } + + @Override + public PageResult getDoctorPage(DoctorPageReqVO pageReqVO) { + return doctorMapper.selectPage(pageReqVO); + } + + @Override + public DoctorDO getDoctorByDoctorId(String doctorid) { + return doctorMapper.selectOne(new LambdaQueryWrapper().eq(DoctorDO::getDoctorid, doctorid)); + } +} \ No newline at end of file diff --git a/yudao-module-system/src/main/resources/mapper/doctor/DoctorMapper.xml b/yudao-module-system/src/main/resources/mapper/doctor/DoctorMapper.xml new file mode 100644 index 0000000..7c1b30c --- /dev/null +++ b/yudao-module-system/src/main/resources/mapper/doctor/DoctorMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/yudao-server/src/main/resources/application.yaml b/yudao-server/src/main/resources/application.yaml index 5b82af1..87a712c 100644 --- a/yudao-server/src/main/resources/application.yaml +++ b/yudao-server/src/main/resources/application.yaml @@ -291,6 +291,7 @@ yudao: - tb_cgmdata #忽略动态血压数据表 - tb_arterial #忽略动态血压人员信息表 - tb_arterialdata #忽略动态血压数据表 + - tb_doctor #忽略医生表 ignore-caches: - user_role_ids - permission_menu_ids