eight
2024-09-26 137e9fb1f28d213d2608c12e17ece1dd57cec452
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/DevRentController.java
@@ -46,6 +46,19 @@
    @Resource
    private DeviceService deviceService;
    @PostMapping("/dev-ready")
    @Operation(summary = "设备准备")
    @PreAuthorize("@ss.hasPermission('ecg:doctor:task')")
    public CommonResult<Long> devReady(@Valid @RequestBody DevRentSaveReqVO createReqVO) {
        try {
            return devRentService.readyOperation(createReqVO);
        } catch ( RuntimeException runtimeException ) {
            String err = ExceptionUtils.formatException( runtimeException );
            log.error("devInstall: " + err);
            return CommonResult.error(DEV_INSTALL_EXCEPTION);
        }
    }
    @PostMapping("/dev-install")
    @Operation(summary = "装机")
    @PreAuthorize("@ss.hasPermission('ecg:doctor:task')")
@@ -129,7 +142,16 @@
    @PreAuthorize("@ss.hasPermission('ecg:doctor:task')")
    public CommonResult<DevRentRespVO> getDevRent(@RequestParam("id") Long id) {
        DevRentDO devRent = devRentService.getDevRent(id);
        return CommonResult.success(BeanUtils.toBean(devRent, DevRentRespVO.class));
        DevRentRespVO devRentRespVO = BeanUtils.toBean(devRent, DevRentRespVO.class);
        DeviceDO deviceDO = deviceService.getDevice( devRent.getDevId() );
        if (null != deviceDO) {
            devRentRespVO.setCategory(deviceDO.getCategory());
            devRentRespVO.setBrand(deviceDO.getBrand());
            devRentRespVO.setModel(deviceDO.getModel());
        }
        return CommonResult.success(devRentRespVO);
    }
    @GetMapping("/page")
@@ -153,12 +175,33 @@
                        BeanUtils.toBean(list, DevRentRespVO.class));
    }
    @GetMapping("/get-latest-rent")
    @GetMapping("/get-ready-rent")
    @Operation(summary = "获取患者设备的最近租赁情况")
    @PreAuthorize("@ss.hasPermission('ecg:doctor:task')")
    public CommonResult<DevRentRespVO> getLatestRent( @Valid DevRentSearchReqVO searchReqVO )
    public CommonResult<DevRentRespVO> getReadyRent( @Valid DevRentSearchReqVO searchReqVO )
    {
        DevRentDO devRent = devRentService.getLatestRent( searchReqVO );
        DevRentDO devRent = devRentService.getReadyOrCancelledRent( searchReqVO );
        if (null == devRent) {
            return CommonResult.success(null);
        }
        DevRentRespVO devRentRespVO = BeanUtils.toBean(devRent, DevRentRespVO.class);
        DeviceDO deviceDO = deviceService.getDevice( devRent.getDevId() );
        if (null != deviceDO) {
            devRentRespVO.setCategory(deviceDO.getCategory());
            devRentRespVO.setBrand(deviceDO.getBrand());
            devRentRespVO.setModel(deviceDO.getModel());
        }
        return CommonResult.success(devRentRespVO);
    }
    @GetMapping("/get-installed-rent")
    @Operation(summary = "获取患者设备的最近租赁情况")
    @PreAuthorize("@ss.hasPermission('ecg:doctor:task')")
    public CommonResult<DevRentRespVO> getInstalledRent( @Valid DevRentSearchReqVO searchReqVO )
    {
        DevRentDO devRent = devRentService.getInstalledOrCancelledRent( searchReqVO );
        if (null == devRent) {
            return CommonResult.success(null);
        }