eight
2024-09-10 a45631c317411128948d2dfa3539bef0337dd64e
update
已修改12个文件
85 ■■■■■ 文件已修改
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/DevRentController.java 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentRespVO.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentSaveReqVO.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/JobRecordController.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/vo/JobRecordSaveReqVO.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/devrent/DevRentDO.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/devrent/DevRentMapper.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/jobrecord/JobRecordService.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/jobrecord/JobRecordServiceImpl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
sql/mysql/jh.sql 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/DevRentController.java
@@ -40,14 +40,14 @@
    @PostMapping("/create")
    @Operation(summary = "创建装机拆机")
    @PreAuthorize("@ss.hasPermission('ecg:dev-rent:create')")
    public CommonResult<Integer> createDevRent(@Valid @RequestBody DevRentSaveReqVO createReqVO) {
    @PreAuthorize("@ss.hasPermission('ecg:doctor:task')")
    public CommonResult<Long> createDevRent(@Valid @RequestBody DevRentSaveReqVO createReqVO) {
        return success(devRentService.createDevRent(createReqVO));
    }
    @PutMapping("/update")
    @Operation(summary = "更新装机拆机")
    @PreAuthorize("@ss.hasPermission('ecg:dev-rent:update')")
    @PreAuthorize("@ss.hasPermission('ecg:doctor:task')")
    public CommonResult<Boolean> updateDevRent(@Valid @RequestBody DevRentSaveReqVO updateReqVO) {
        devRentService.updateDevRent(updateReqVO);
        return success(true);
@@ -56,8 +56,8 @@
    @DeleteMapping("/delete")
    @Operation(summary = "删除装机拆机")
    @Parameter(name = "id", description = "编号", required = true)
    @PreAuthorize("@ss.hasPermission('ecg:dev-rent:delete')")
    public CommonResult<Boolean> deleteDevRent(@RequestParam("id") Integer id) {
    @PreAuthorize("@ss.hasPermission('ecg:doctor:task')")
    public CommonResult<Boolean> deleteDevRent(@RequestParam("id") Long id) {
        devRentService.deleteDevRent(id);
        return success(true);
    }
@@ -65,15 +65,15 @@
    @GetMapping("/get")
    @Operation(summary = "获得装机拆机")
    @Parameter(name = "id", description = "编号", required = true, example = "1024")
    @PreAuthorize("@ss.hasPermission('ecg:dev-rent:query')")
    public CommonResult<DevRentRespVO> getDevRent(@RequestParam("id") Integer id) {
    @PreAuthorize("@ss.hasPermission('ecg:doctor:task')")
    public CommonResult<DevRentRespVO> getDevRent(@RequestParam("id") Long id) {
        DevRentDO devRent = devRentService.getDevRent(id);
        return success(BeanUtils.toBean(devRent, DevRentRespVO.class));
    }
    @GetMapping("/page")
    @Operation(summary = "获得装机拆机分页")
    @PreAuthorize("@ss.hasPermission('ecg:dev-rent:query')")
    @PreAuthorize("@ss.hasPermission('ecg:doctor:task')")
    public CommonResult<PageResult<DevRentRespVO>> getDevRentPage(@Valid DevRentPageReqVO pageReqVO) {
        PageResult<DevRentDO> pageResult = devRentService.getDevRentPage(pageReqVO);
        return success(BeanUtils.toBean(pageResult, DevRentRespVO.class));
@@ -92,4 +92,15 @@
                        BeanUtils.toBean(list, DevRentRespVO.class));
    }
    @GetMapping("/get-latest-rent")
    @Operation(summary = "获取患者设备的最近租赁情况")
    @Parameter(name = "pat-id", description = "患者编号", required = true, example = "1024")
    @Parameter(name = "dev-id", description = "设备编号", required = true, example = "1024")
    @PreAuthorize("@ss.hasPermission('ecg:doctor:task')")
    public CommonResult<DevRentRespVO> getLatestRent(
            @RequestParam("pat-id") String patId, @RequestParam("dev-id") String devId)
    {
        DevRentDO devRent = devRentService.getLatestRent(patId, devId);
        return success(BeanUtils.toBean(devRent, DevRentRespVO.class));
    }
}
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentRespVO.java
@@ -14,7 +14,7 @@
    @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "26525")
    @ExcelProperty("id")
    private Integer id;
    private Long id;
    @Schema(description = "设备编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3986")
    @ExcelProperty("设备编号")
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentSaveReqVO.java
@@ -11,7 +11,7 @@
public class DevRentSaveReqVO {
    @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "26525")
    private Integer id;
    private Long id;
    @Schema(description = "设备编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3986")
    @NotEmpty(message = "设备编号不能为空")
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/JobRecordController.java
@@ -1,16 +1,12 @@
package cn.lihu.jh.module.ecg.controller.admin.jobrecord;
import org.springframework.web.bind.annotation.*;
import jakarta.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 jakarta.validation.constraints.*;
import jakarta.validation.*;
import jakarta.servlet.http.*;
import java.util.*;
import java.io.IOException;
@@ -28,6 +24,10 @@
import cn.lihu.jh.module.ecg.controller.admin.jobrecord.vo.*;
import cn.lihu.jh.module.ecg.dal.dataobject.jobrecord.JobRecordDO;
import cn.lihu.jh.module.ecg.service.jobrecord.JobRecordService;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
@Tag(name = "管理后台 - 工作记录")
@RestController
@@ -93,3 +93,4 @@
    }
}
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/vo/JobRecordSaveReqVO.java
@@ -3,8 +3,9 @@
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 工作记录新增/修改 Request VO")
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/devrent/DevRentDO.java
@@ -28,7 +28,7 @@
     * id
     */
    @TableId
    private Integer id;
    private Long id;
    /**
     * 设备编号
     */
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/devrent/DevRentMapper.java
@@ -8,6 +8,8 @@
import cn.lihu.jh.module.ecg.dal.dataobject.devrent.DevRentDO;
import org.apache.ibatis.annotations.Mapper;
import cn.lihu.jh.module.ecg.controller.admin.devrent.vo.*;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
/**
 * 装机拆机 Mapper
@@ -32,4 +34,8 @@
                .orderByDesc(DevRentDO::getId));
    }
    @Select("select * from lihu.dev_rent where pat_id=#{patId} and dev_id=#{devId} order by rent_time desc limit 1")
    DevRentDO getLatestRent(@Param("patId") String patId, @Param("devId") String devId);
}
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentService.java
@@ -21,7 +21,7 @@
     * @param createReqVO 创建信息
     * @return 编号
     */
    Integer createDevRent(@Valid DevRentSaveReqVO createReqVO);
    Long createDevRent(@Valid DevRentSaveReqVO createReqVO);
    /**
     * 更新装机拆机
@@ -35,7 +35,7 @@
     *
     * @param id 编号
     */
    void deleteDevRent(Integer id);
    void deleteDevRent(Long id);
    /**
     * 获得装机拆机
@@ -43,7 +43,7 @@
     * @param id 编号
     * @return 装机拆机
     */
    DevRentDO getDevRent(Integer id);
    DevRentDO getDevRent(Long id);
    /**
     * 获得装机拆机分页
@@ -53,4 +53,5 @@
     */
    PageResult<DevRentDO> getDevRentPage(DevRentPageReqVO pageReqVO);
    DevRentDO getLatestRent(String patId, String devId);
}
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java
@@ -31,7 +31,9 @@
    private DevRentMapper devRentMapper;
    @Override
    public Integer createDevRent(DevRentSaveReqVO createReqVO) {
    public Long createDevRent(DevRentSaveReqVO createReqVO) {
        //
        // 插入
        DevRentDO devRent = BeanUtils.toBean(createReqVO, DevRentDO.class);
        devRentMapper.insert(devRent);
@@ -49,21 +51,21 @@
    }
    @Override
    public void deleteDevRent(Integer id) {
    public void deleteDevRent(Long id) {
        // 校验存在
        validateDevRentExists(id);
        // 删除
        devRentMapper.deleteById(id);
    }
    private void validateDevRentExists(Integer id) {
    private void validateDevRentExists(Long id) {
        if (devRentMapper.selectById(id) == null) {
            throw exception(DEV_RENT_NOT_EXISTS);
        }
    }
    @Override
    public DevRentDO getDevRent(Integer id) {
    public DevRentDO getDevRent(Long id) {
        return devRentMapper.selectById(id);
    }
@@ -72,4 +74,9 @@
        return devRentMapper.selectPage(pageReqVO);
    }
    @Override
    public DevRentDO getLatestRent(String patId, String devId) {
        return devRentMapper.getLatestRent(patId, devId);
    }
}
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/jobrecord/JobRecordService.java
@@ -1,11 +1,12 @@
package cn.lihu.jh.module.ecg.service.jobrecord;
import java.util.*;
import jakarta.validation.*;
import cn.lihu.jh.module.ecg.controller.admin.jobrecord.vo.*;
import cn.lihu.jh.module.ecg.dal.dataobject.jobrecord.JobRecordDO;
import cn.lihu.jh.framework.common.pojo.PageResult;
import cn.lihu.jh.framework.common.pojo.PageParam;
import javax.validation.Valid;
/**
 * 工作记录 Service 接口
@@ -53,3 +54,4 @@
    PageResult<JobRecordDO> getJobRecordPage(JobRecordPageReqVO pageReqVO);
}
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/jobrecord/JobRecordServiceImpl.java
@@ -1,19 +1,17 @@
package cn.lihu.jh.module.ecg.service.jobrecord;
import org.springframework.stereotype.Service;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import cn.lihu.jh.module.ecg.controller.admin.jobrecord.vo.*;
import cn.lihu.jh.module.ecg.dal.dataobject.jobrecord.JobRecordDO;
import cn.lihu.jh.framework.common.pojo.PageResult;
import cn.lihu.jh.framework.common.pojo.PageParam;
import cn.lihu.jh.framework.common.util.object.BeanUtils;
import cn.lihu.jh.module.ecg.dal.mysql.jobrecord.JobRecordMapper;
import javax.annotation.Resource;
import static cn.lihu.jh.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.lihu.jh.module.ecg.enums.ErrorCodeConstants.*;
sql/mysql/jh.sql
@@ -140,7 +140,7 @@
-- ----------------------------
DROP TABLE IF EXISTS `dev_rent`;
CREATE TABLE `dev_rent` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT 'id',
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
  `dev_id` varchar(45) DEFAULT NULL COMMENT '设备编号',
  `pat_id` varchar(45) DEFAULT NULL COMMENT '患者编号',
  `pat_name` varchar(45) DEFAULT NULL COMMENT '患者名称',