From a45631c317411128948d2dfa3539bef0337dd64e Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期二, 10 九月 2024 14:14:05 +0800
Subject: [PATCH] update
---
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/jobrecord/JobRecordServiceImpl.java | 6 +--
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/devrent/DevRentMapper.java | 6 +++
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentRespVO.java | 2
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/JobRecordController.java | 11 +++--
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentService.java | 7 ++-
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentSaveReqVO.java | 2
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/devrent/DevRentDO.java | 2
sql/mysql/jh.sql | 2
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/DevRentController.java | 29 ++++++++++----
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/vo/JobRecordSaveReqVO.java | 3 +
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java | 15 +++++--
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/jobrecord/JobRecordService.java | 6 ++-
12 files changed, 59 insertions(+), 32 deletions(-)
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/DevRentController.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/DevRentController.java
index bd79b4f..7b1766e 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/DevRentController.java
+++ b/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));
}
-}
\ No newline at end of file
+ @GetMapping("/get-latest-rent")
+ @Operation(summary = "鑾峰彇鎮h�呰澶囩殑鏈�杩戠璧佹儏鍐�")
+ @Parameter(name = "pat-id", description = "鎮h�呯紪鍙�", 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));
+ }
+}
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentRespVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentRespVO.java
index 4099444..fb16cb0 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentRespVO.java
+++ b/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("璁惧缂栧彿")
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentSaveReqVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentSaveReqVO.java
index 7e0b981..6a54acd 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentSaveReqVO.java
+++ b/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 = "璁惧缂栧彿涓嶈兘涓虹┖")
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/JobRecordController.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/JobRecordController.java
index a6c2d15..b18ac68 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/JobRecordController.java
+++ b/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
@@ -92,4 +92,5 @@
BeanUtils.toBean(list, JobRecordRespVO.class));
}
-}
\ No newline at end of file
+}
+
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/vo/JobRecordSaveReqVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/vo/JobRecordSaveReqVO.java
index 781531c..07006b0 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/vo/JobRecordSaveReqVO.java
+++ b/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")
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/devrent/DevRentDO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/devrent/DevRentDO.java
index 718bda3..8bcd9af 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/devrent/DevRentDO.java
+++ b/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;
/**
* 璁惧缂栧彿
*/
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/devrent/DevRentMapper.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/devrent/DevRentMapper.java
index b0a998f..d39c1cb 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/devrent/DevRentMapper.java
+++ b/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);
+
+
}
\ No newline at end of file
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentService.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentService.java
index 0d6d562..04e2fc3 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentService.java
+++ b/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);
}
\ No newline at end of file
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java
index a7b6021..1815eae 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java
+++ b/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);
+ }
+
}
\ No newline at end of file
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/jobrecord/JobRecordService.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/jobrecord/JobRecordService.java
index 0faa3f6..3a4040c 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/jobrecord/JobRecordService.java
+++ b/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 鎺ュ彛
@@ -52,4 +53,5 @@
*/
PageResult<JobRecordDO> getJobRecordPage(JobRecordPageReqVO pageReqVO);
-}
\ No newline at end of file
+}
+
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/jobrecord/JobRecordServiceImpl.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/jobrecord/JobRecordServiceImpl.java
index 3b45995..6093aa1 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/jobrecord/JobRecordServiceImpl.java
+++ b/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.*;
diff --git a/sql/mysql/jh.sql b/sql/mysql/jh.sql
index dbef098..c9ce010 100644
--- a/sql/mysql/jh.sql
+++ b/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 '鎮h�呯紪鍙�',
`pat_name` varchar(45) DEFAULT NULL COMMENT '鎮h�呭悕绉�',
--
Gitblit v1.9.3