| | |
| | | package cn.lihu.jh.module.ecg.controller.admin.devrent; |
| | | |
| | | import cn.lihu.jh.framework.security.core.util.SecurityFrameworkUtils; |
| | | import cn.lihu.jh.module.ecg.dal.dataobject.appointment.AppointmentDO; |
| | | import cn.lihu.jh.module.ecg.dal.dataobject.devmanage.DeviceDO; |
| | | import cn.lihu.jh.module.ecg.enums.DevStateEnum; |
| | | import cn.lihu.jh.module.ecg.service.appointment.AppointmentService; |
| | | import cn.lihu.jh.module.ecg.service.devmanage.DeviceService; |
| | | import cn.lihu.jh.module.ecg.service.queue.QueueService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | import cn.lihu.jh.framework.excel.core.util.ExcelUtils; |
| | | |
| | | import cn.lihu.jh.framework.apilog.core.annotation.ApiAccessLog; |
| | | |
| | | import static cn.lihu.jh.framework.apilog.core.enums.OperateTypeEnum.*; |
| | | |
| | | import cn.lihu.jh.module.ecg.controller.admin.devrent.vo.*; |
| | |
| | | |
| | | @Resource |
| | | private QueueService queueService; |
| | | |
| | | @Resource |
| | | private AppointmentService appointmentService; |
| | | |
| | | // 常规检查 完成 |
| | | @PostMapping("/routine-finish") |
| | |
| | | @Operation(summary = "遗失") |
| | | @PreAuthorize("@ss.hasPermission('ecg:doctor:task')") |
| | | public CommonResult<Long> devLose(@Valid @RequestBody DevRentSaveReqVO loseReqVO) { |
| | | loseReqVO.setState( DevStateEnum.LOST.getState() ); |
| | | loseReqVO.setState(DevStateEnum.LOST.getState()); |
| | | return devRentService.dismantleExceptionOperation(loseReqVO); |
| | | } |
| | | |
| | |
| | | @Operation(summary = "损坏") |
| | | @PreAuthorize("@ss.hasPermission('ecg:doctor:task')") |
| | | public CommonResult<Long> devDamage(@Valid @RequestBody DevRentSaveReqVO damageReqVO) { |
| | | damageReqVO.setState( DevStateEnum.DAMAGED.getState() ); |
| | | damageReqVO.setState(DevStateEnum.DAMAGED.getState()); |
| | | return devRentService.dismantleExceptionOperation(damageReqVO); |
| | | } |
| | | |
| | |
| | | |
| | | DevRentRespVO devRentRespVO = BeanUtils.toBean(devRent, DevRentRespVO.class); |
| | | |
| | | DeviceDO deviceDO = deviceService.getDevice( devRent.getDevId() ); |
| | | DeviceDO deviceDO = deviceService.getDevice(devRent.getDevId()); |
| | | if (null != deviceDO) { |
| | | devRentRespVO.setCategory(deviceDO.getCategory()); |
| | | devRentRespVO.setBrand(deviceDO.getBrand()); |
| | |
| | | @Operation(summary = "导出装机拆机 Excel") |
| | | @PreAuthorize("@ss.hasPermission('ecg:dev-rent:export')") |
| | | @ApiAccessLog(operateType = EXPORT) |
| | | public void exportDevRentExcel(@Valid DevRentPageReqVO pageReqVO, |
| | | HttpServletResponse response) throws IOException { |
| | | public void exportDevRentExcel(@Valid DevRentPageReqVO pageReqVO, HttpServletResponse response) throws IOException { |
| | | pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); |
| | | List<DevRentDO> list = devRentService.getDevRentPage(pageReqVO).getList(); |
| | | // 导出 Excel |
| | | ExcelUtils.write(response, "装机拆机.xls", "数据", DevRentRespVO.class, |
| | | BeanUtils.toBean(list, DevRentRespVO.class)); |
| | | ExcelUtils.write(response, "装机拆机.xls", "数据", DevRentRespVO.class, BeanUtils.toBean(list, DevRentRespVO.class)); |
| | | } |
| | | |
| | | @GetMapping("/get-free-rent") |
| | | @Operation(summary = "根据患者或设备, 获取已领取租赁情况") |
| | | @PreAuthorize("@ss.hasPermission('ecg:doctor:task')") |
| | | public CommonResult<DevRentRespVO> getFreeRent( @Valid DevRentSearchReqVO searchReqVO ) |
| | | { |
| | | DevRentDO devRent = devRentService.getFreeRent( searchReqVO ); |
| | | public CommonResult<DevRentRespVO> getFreeRent(@Valid DevRentSearchReqVO searchReqVO) { |
| | | DevRentDO devRent = devRentService.getFreeRent(searchReqVO); |
| | | if (null == devRent) { |
| | | return CommonResult.success(null); |
| | | } |
| | |
| | | @GetMapping("/get-ready-rent") |
| | | @Operation(summary = "获取已领取租赁情况") |
| | | @PreAuthorize("@ss.hasPermission('ecg:doctor:task')") |
| | | public CommonResult<DevRentRespVO> getReadyRent( @Valid DevRentSearchReqVO searchReqVO ) |
| | | { |
| | | DevRentDO devRent = devRentService.getReadyOrCancelledRent( searchReqVO ); |
| | | public CommonResult<DevRentRespVO> getReadyRent(@Valid DevRentSearchReqVO 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() ); |
| | | DeviceDO deviceDO = deviceService.getDevice(devRent.getDevId()); |
| | | if (null != deviceDO) { |
| | | devRentRespVO.setCategory(deviceDO.getCategory()); |
| | | devRentRespVO.setBrand(deviceDO.getBrand()); |
| | |
| | | @GetMapping("/get-existing-rent") |
| | | @Operation(summary = "获取已安装、已领用的租赁情况") |
| | | @PreAuthorize("@ss.hasPermission('ecg:doctor:task')") |
| | | public CommonResult<DevRentRespVO> getInstalledRent( @Valid DevRentSearchReqVO searchReqVO ) |
| | | { |
| | | DevRentDO devRent = devRentService.getExistingRent( searchReqVO ); |
| | | public CommonResult<DevRentRespVO> getInstalledRent(@Valid DevRentSearchReqVO searchReqVO) { |
| | | DevRentDO devRent = devRentService.getExistingRent(searchReqVO); |
| | | if (null == devRent) { |
| | | return CommonResult.success(null); |
| | | } |
| | | |
| | | DeviceDO deviceDO = deviceService.getDevice( devRent.getDevId() ); |
| | | DeviceDO deviceDO = deviceService.getDevice(devRent.getDevId()); |
| | | |
| | | DevRentRespVO devRentRespVO = BeanUtils.toBean(devRent, DevRentRespVO.class); |
| | | devRentRespVO.setCategory( deviceDO.getCategory() ); |
| | | devRentRespVO.setBrand( deviceDO.getBrand() ); |
| | | devRentRespVO.setModel( deviceDO.getModel() ); |
| | | devRentRespVO.setDevState( devRent.getState() ); |
| | | devRentRespVO.setCategory(deviceDO.getCategory()); |
| | | devRentRespVO.setBrand(deviceDO.getBrand()); |
| | | devRentRespVO.setModel(deviceDO.getModel()); |
| | | devRentRespVO.setDevState(devRent.getState()); |
| | | return CommonResult.success(devRentRespVO); |
| | | } |
| | | |
| | | @GetMapping("/get-dismantled-rent") |
| | | @Operation(summary = "获取已拆卸租赁情况") |
| | | @PreAuthorize("@ss.hasPermission('ecg:doctor:task')") |
| | | public CommonResult<DevRentRespVO> getDismantledRent( @Valid DevRentSearchReqVO searchReqVO ) |
| | | { |
| | | DevRentDO devRent = devRentService.getDismantledRent( searchReqVO ); |
| | | public CommonResult<DevRentRespVO> getDismantledRent(@Valid DevRentSearchReqVO searchReqVO) { |
| | | DevRentDO devRent = devRentService.getDismantledRent(searchReqVO); |
| | | if (null == devRent) { |
| | | return CommonResult.success(null); |
| | | } |
| | | |
| | | DeviceDO deviceDO = deviceService.getDevice( devRent.getDevId() ); |
| | | DeviceDO deviceDO = deviceService.getDevice(devRent.getDevId()); |
| | | |
| | | DevRentRespVO devRentRespVO = BeanUtils.toBean(devRent, DevRentRespVO.class); |
| | | devRentRespVO.setCategory( deviceDO.getCategory() ); |
| | | devRentRespVO.setBrand( deviceDO.getBrand() ); |
| | | devRentRespVO.setModel( deviceDO.getModel() ); |
| | | devRentRespVO.setCategory(deviceDO.getCategory()); |
| | | devRentRespVO.setBrand(deviceDO.getBrand()); |
| | | devRentRespVO.setModel(deviceDO.getModel()); |
| | | return CommonResult.success(devRentRespVO); |
| | | } |
| | | |
| | |
| | | String userHisId = SecurityFrameworkUtils.getLoginUserHisId(); |
| | | |
| | | Integer result = devRentService.feeConfirm(rentId, userHisId, userNickname, true); |
| | | if (1 == result) |
| | | return CommonResult.error(result, "确费失败"); |
| | | if (1 == result) return CommonResult.error(result, "确费失败"); |
| | | |
| | | return CommonResult.success(result); |
| | | } |
| | |
| | | String userHisId = SecurityFrameworkUtils.getLoginUserHisId(); |
| | | |
| | | Integer result = devRentService.feeConfirm(rentId, userHisId, userNickname, false); |
| | | if (1 == result) |
| | | return CommonResult.error(result, "取消确费失败"); |
| | | if (1 == result) return CommonResult.error(result, "取消确费失败"); |
| | | |
| | | return CommonResult.success(result); |
| | | } |