医生管理

This commit is contained in:
Flow 2025-07-25 16:36:12 +08:00
parent 30be413a14
commit 7aa925393f
10 changed files with 460 additions and 0 deletions

View File

@ -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<Integer> createDoctor(@Valid @RequestBody DoctorSaveReqVO createReqVO) {
return success(doctorService.createDoctor(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新保存医生签名信息")
public CommonResult<Boolean> updateDoctor(@Valid @RequestBody DoctorSaveReqVO updateReqVO) {
doctorService.updateDoctor(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除保存医生签名信息")
@Parameter(name = "id", description = "编号", required = true)
public CommonResult<Boolean> deleteDoctor(@RequestParam("id") Integer id) {
doctorService.deleteDoctor(id);
return success(true);
}
@DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除保存医生签名信息")
public CommonResult<Boolean> deleteDoctorList(@RequestParam("ids") List<Integer> ids) {
doctorService.deleteDoctorListByIds(ids);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得保存医生签名信息")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
public CommonResult<DoctorRespVO> getDoctor(@RequestParam("id") Integer id) {
DoctorDO doctor = doctorService.getDoctor(id);
return success(BeanUtils.toBean(doctor, DoctorRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得保存医生签名信息分页")
public CommonResult<PageResult<DoctorRespVO>> getDoctorPage(@Valid DoctorPageReqVO pageReqVO) {
PageResult<DoctorDO> 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<DoctorDO> 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<DoctorRespVO> getDoctorByDoctorId(@RequestParam("doctorid") String doctorid) {
DoctorDO doctor = doctorService.getDoctorByDoctorId(doctorid);
return success(BeanUtils.toBean(doctor, DoctorRespVO.class));
}
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 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;
}

View File

@ -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<DoctorDO> {
default PageResult<DoctorDO> selectPage(DoctorPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<DoctorDO>()
.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));
}
}

View File

@ -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<Integer> ids);
/**
* 获得保存医生签名信息
*
* @param id 编号
* @return 保存医生签名信息
*/
DoctorDO getDoctor(Integer id);
/**
* 根据医生doctorid查询医生信息
* @param doctorid 医生编号
* @return 医生信息
*/
DoctorDO getDoctorByDoctorId(String doctorid);
/**
* 获得保存医生签名信息分页
*
* @param pageReqVO 分页查询
* @return 保存医生签名信息分页
*/
PageResult<DoctorDO> getDoctorPage(DoctorPageReqVO pageReqVO);
}

View File

@ -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<Integer> ids) {
// 校验存在
validateDoctorExists(ids);
// 删除
doctorMapper.deleteByIds(ids);
}
private void validateDoctorExists(List<Integer> ids) {
List<DoctorDO> 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<DoctorDO> getDoctorPage(DoctorPageReqVO pageReqVO) {
return doctorMapper.selectPage(pageReqVO);
}
@Override
public DoctorDO getDoctorByDoctorId(String doctorid) {
return doctorMapper.selectOne(new LambdaQueryWrapper<DoctorDO>().eq(DoctorDO::getDoctorid, doctorid));
}
}

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

View File

@ -291,6 +291,7 @@ yudao:
- tb_cgmdata #忽略动态血压数据表 - tb_cgmdata #忽略动态血压数据表
- tb_arterial #忽略动态血压人员信息表 - tb_arterial #忽略动态血压人员信息表
- tb_arterialdata #忽略动态血压数据表 - tb_arterialdata #忽略动态血压数据表
- tb_doctor #忽略医生表
ignore-caches: ignore-caches:
- user_role_ids - user_role_ids
- permission_menu_ids - permission_menu_ids