From 1e5a82d409067c435caff8305d530c35f64db059 Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期三, 25 九月 2024 18:32:24 +0800
Subject: [PATCH] 新装机 功能
---
jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/DevRentStateEnum.java | 2
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/devrent/DevRentMapper.java | 3 -
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentService.java | 3 +
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentSearchReqVO.java | 3 +
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/DevRentController.java | 25 +++++++++++-
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java | 28 ++++++++++---
jh-module-ecg/jh-module-ecg-biz/src/main/resources/mapper/devrent/DevRentMapper.xml | 9 +++-
7 files changed, 55 insertions(+), 18 deletions(-)
diff --git a/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/DevRentStateEnum.java b/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/DevRentStateEnum.java
index 67f6a74..3a530af 100644
--- a/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/DevRentStateEnum.java
+++ b/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/DevRentStateEnum.java
@@ -16,7 +16,7 @@
@AllArgsConstructor
public enum DevRentStateEnum implements IntArrayValuable {
FREE(0, "寰呰鏈�"),
- RECEIVED(5, "宸查鍙�"),
+ READY(5, "宸查鍙�"),
INSTALLED(10, "宸茶鏈�"),
DISMANTLED(20, "宸叉媶鏈�"),
CANCELLED(30, "宸叉斁寮�"),
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 62016f1..d04de5b 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
@@ -2,7 +2,6 @@
import cn.lihu.jh.framework.common.util.exception.ExceptionUtils;
import cn.lihu.jh.module.ecg.dal.dataobject.devmanage.DeviceDO;
-import cn.lihu.jh.module.ecg.enums.DevRentStateEnum;
import cn.lihu.jh.module.ecg.service.devmanage.DeviceService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
@@ -167,13 +166,33 @@
BeanUtils.toBean(list, DevRentRespVO.class));
}
+ @GetMapping("/get-ready-rent")
+ @Operation(summary = "鑾峰彇鎮h�呰澶囩殑鏈�杩戠璧佹儏鍐�")
+ @PreAuthorize("@ss.hasPermission('ecg:doctor:task')")
+ 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() );
+ if (null != deviceDO) {
+ devRentRespVO.setCategory(deviceDO.getCategory());
+ devRentRespVO.setBrand(deviceDO.getBrand());
+ devRentRespVO.setModel(deviceDO.getModel());
+ }
+ return CommonResult.success(devRentRespVO);
+ }
+
@GetMapping("/get-dismantle-rent")
@Operation(summary = "鑾峰彇鎮h�呰澶囩殑鏈�杩戠璧佹儏鍐�")
@PreAuthorize("@ss.hasPermission('ecg:doctor:task')")
public CommonResult<DevRentRespVO> getLatestRent( @Valid DevRentSearchReqVO searchReqVO )
{
- searchReqVO.setState( DevRentStateEnum.INSTALLED.getState() );
- DevRentDO devRent = devRentService.getDismantleRent( searchReqVO );
+ DevRentDO devRent = devRentService.getInstalledOrCancelledRent( searchReqVO );
if (null == devRent) {
return CommonResult.success(null);
}
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentSearchReqVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentSearchReqVO.java
index 5867d9c..4590c84 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentSearchReqVO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentSearchReqVO.java
@@ -9,6 +9,7 @@
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
+import java.util.List;
import static cn.lihu.jh.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@@ -28,5 +29,5 @@
private String patName;
@Schema(description = "鐘舵��")
- private Integer state;
+ private List<Integer> stateList;
}
\ No newline at end of file
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 c90ef5a..87ed479 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
@@ -10,7 +10,6 @@
import cn.lihu.jh.module.ecg.controller.admin.devrent.vo.*;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
-import org.apache.ibatis.annotations.Update;
/**
* 瑁呮満鎷嗘満 Mapper
@@ -35,7 +34,7 @@
.orderByDesc(DevRentDO::getId));
}
- DevRentDO getDismantleRentByState(DevRentSearchReqVO reqVO );
+ DevRentDO getRentByState(DevRentSearchReqVO reqVO );
@Select("select * from lihu.dev_rent where state=#{state} and pat_id=#{patId}")
List<DevRentDO> selectByPatIdAndState(@Param("patId") String patId, @Param("state") Integer state);
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 3a8d70a..93733c6 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
@@ -100,5 +100,6 @@
*/
PageResult<DevRentDO> getDevRentPage(DevRentPageReqVO pageReqVO);
- DevRentDO getDismantleRent(DevRentSearchReqVO searchReqVO);
+ DevRentDO getInstalledOrCancelledRent(DevRentSearchReqVO searchReqVO);
+ DevRentDO getReadyOrCancelledRent(DevRentSearchReqVO searchReqVO);
}
\ 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 549f067..4ccd1fd 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
@@ -15,6 +15,7 @@
import java.time.LocalDate;
import java.time.LocalDateTime;
+import java.util.ArrayList;
import java.util.List;
import cn.lihu.jh.module.ecg.controller.admin.devrent.vo.*;
@@ -75,7 +76,7 @@
rent_id = devRentDOList.getFirst().getId();
createReqVO.setId( rent_id );
- createReqVO.setState( DevRentStateEnum.RECEIVED.getState() );
+ createReqVO.setState( DevRentStateEnum.READY.getState() );
updateDevRent( createReqVO );
JobRecordSaveReqVO jobRecordSaveReqVO = new JobRecordSaveReqVO();
@@ -86,7 +87,7 @@
jobRecordSaveReqVO.setPatId(createReqVO.getPatId());
jobRecordSaveReqVO.setPatName(createReqVO.getPatName());
jobRecordSaveReqVO.setJobTime(createReqVO.getRentTime());
- jobRecordSaveReqVO.setJobType( DevRentStateEnum.RECEIVED.getState() );
+ jobRecordSaveReqVO.setJobType( DevRentStateEnum.READY.getState() );
jobRecordSaveReqVO.setRemark(createReqVO.getRemark());
jobRecordSaveReqVO.setSummary("");
@@ -94,14 +95,14 @@
jobRecordMapper.insert(jobRecord);
} else {
// 鎾ら攢 鏀惧純鎿嶄綔
- createReqVO.setState( DevRentStateEnum.RECEIVED.getState() );
+ createReqVO.setState( DevRentStateEnum.READY.getState() );
updateDevRent( createReqVO );
JobRecordDO jobRecordDO = jobRecordMapper.selectByRentIdDocId(rent_id, userId);
if (null != jobRecordDO) {
jobRecordDO.setDevId(createReqVO.getDevId());
- jobRecordDO.setJobType( DevRentStateEnum.RECEIVED.getState() );
+ jobRecordDO.setJobType( DevRentStateEnum.READY.getState() );
jobRecordDO.setJobTime(createReqVO.getRentTime());
jobRecordDO.setRemark(createReqVO.getRemark());
jobRecordDO.setUpdater(String.valueOf(userId));
@@ -126,7 +127,7 @@
Long rent_id = createReqVO.getId();
if (null == rent_id) {
- List<DevRentDO> devRentDOList = devRentMapper.selectByPatIdAndState(createReqVO.getPatId(), DevRentStateEnum.RECEIVED.getState());
+ List<DevRentDO> devRentDOList = devRentMapper.selectByPatIdAndState(createReqVO.getPatId(), DevRentStateEnum.READY.getState());
if (devRentDOList.size() == 0)
return CommonResult.error(DEV_INSTALL_NOT_RECEIVED);
else if (devRentDOList.size() != 1) {
@@ -354,8 +355,21 @@
}
@Override
- public DevRentDO getDismantleRent(DevRentSearchReqVO searchReqVO) {
- return devRentMapper.getDismantleRentByState(searchReqVO);
+ public DevRentDO getInstalledOrCancelledRent(DevRentSearchReqVO searchReqVO) {
+ List<Integer> stateList = new ArrayList<>();
+ stateList.add( DevRentStateEnum.INSTALLED.getState() );
+ stateList.add( DevRentStateEnum.CANCELLED.getState() );
+ searchReqVO.setStateList( stateList );
+ return devRentMapper.getRentByState(searchReqVO);
+ }
+
+ @Override
+ public DevRentDO getReadyOrCancelledRent(DevRentSearchReqVO searchReqVO) {
+ List<Integer> stateList = new ArrayList<>();
+ stateList.add( DevRentStateEnum.READY.getState() );
+ stateList.add( DevRentStateEnum.CANCELLED.getState() );
+ searchReqVO.setStateList( stateList );
+ return devRentMapper.getRentByState(searchReqVO);
}
private Integer markDevRecieved(String devId) {
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/resources/mapper/devrent/DevRentMapper.xml b/jh-module-ecg/jh-module-ecg-biz/src/main/resources/mapper/devrent/DevRentMapper.xml
index 0288321..96b122b 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/resources/mapper/devrent/DevRentMapper.xml
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/resources/mapper/devrent/DevRentMapper.xml
@@ -9,11 +9,14 @@
鏂囨。鍙锛歨ttps://www.iocoder.cn/MyBatis/x-plugins/
-->
- <select id="getDismantleRentByState" resultType="cn.lihu.jh.module.ecg.dal.dataobject.devrent.DevRentDO">
+ <select id="getRentByState" resultType="cn.lihu.jh.module.ecg.dal.dataobject.devrent.DevRentDO">
select * from lihu.dev_rent
<where>
- <if test="state != null">
- and state = #{state}
+ <if test="stateList != null">
+ and state in (
+ <foreach collection='stateList' separator=',' item='state'>
+ #{state}
+ </foreach> )
</if>
<if test="devId != null and devId != ''">
and dev_id = #{devId}
--
Gitblit v1.9.3