From 91c60b946e0d2e8abc2c350598aa6d47ed28e83c Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期二, 24 九月 2024 14:36:29 +0800
Subject: [PATCH] 装机&放弃 逻辑新增state
---
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/vo/JobRecordRespVO.java | 8 --
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentRespVO.java | 10 -
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentService.java | 10 ++
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevCancelReqVO.java | 4 -
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentSaveReqVO.java | 9 -
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/devrent/DevRentDO.java | 13 +--
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java | 78 ++++++++++---------
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/vo/JobRecordPageReqVO.java | 5 -
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/jobrecord/JobRecordMapper.java | 8 +-
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/devrent/DevRentMapper.java | 5 +
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/AppointmentController.java | 5 +
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentSearchReqVO.java | 7 -
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceImpl.java | 12 +++
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentPageReqVO.java | 7 -
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/jobrecord/JobRecordDO.java | 11 --
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/DevRentController.java | 6 +
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/vo/JobRecordSaveReqVO.java | 5 -
jh-module-ecg/jh-module-ecg-biz/src/main/resources/mapper/devrent/DevRentMapper.xml | 7 +
18 files changed, 101 insertions(+), 109 deletions(-)
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/AppointmentController.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/AppointmentController.java
index 16070bd..cf2a12d 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/AppointmentController.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/AppointmentController.java
@@ -3,11 +3,13 @@
import cn.hutool.core.bean.BeanUtil;
import cn.lihu.jh.framework.common.exception.ErrorCode;
import cn.lihu.jh.framework.common.util.date.DateUtils;
+import cn.lihu.jh.module.ecg.controller.admin.devrent.vo.DevRentSaveReqVO;
import cn.lihu.jh.module.ecg.controller.admin.queue.vo.QueueSaveReqVO;
import cn.lihu.jh.module.ecg.feign.RemoteDataService;
import cn.lihu.jh.module.ecg.feign.RestApiReqBodyVo;
import cn.lihu.jh.module.ecg.feign.RestApiResult;
import cn.lihu.jh.module.ecg.feign.dto.AppointmentExternal;
+import cn.lihu.jh.module.ecg.service.devrent.DevRentService;
import cn.lihu.jh.module.ecg.service.queue.QueueService;
import cn.lihu.jh.module.ecg.service.room.RoomService;
import cn.lihu.jh.module.system.api.dept.DeptApi;
@@ -69,6 +71,9 @@
private RemoteDataService remoteDataService;
@Resource
+ private DevRentService devRentService;
+
+ @Resource
private DeptApi deptApi;
@PostMapping("/create")
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 ede8494..c6cf8dc 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,6 +2,7 @@
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.*;
@@ -153,12 +154,13 @@
BeanUtils.toBean(list, DevRentRespVO.class));
}
- @GetMapping("/get-latest-rent")
+ @GetMapping("/get-dismantle-rent")
@Operation(summary = "鑾峰彇鎮h�呰澶囩殑鏈�杩戠璧佹儏鍐�")
@PreAuthorize("@ss.hasPermission('ecg:doctor:task')")
public CommonResult<DevRentRespVO> getLatestRent( @Valid DevRentSearchReqVO searchReqVO )
{
- DevRentDO devRent = devRentService.getLatestRent( searchReqVO );
+ searchReqVO.setState( DevRentStateEnum.INSTALLED.getState() );
+ DevRentDO devRent = devRentService.getDismantleRent( 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/DevCancelReqVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevCancelReqVO.java
index e44776e..73b2041 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevCancelReqVO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevCancelReqVO.java
@@ -41,8 +41,4 @@
@Schema(description = "澶囨敞", example = "浣犵寽")
private String remark;
-
- @Schema(description = "鍙栨秷瀹夎")
- private Integer cancelled;
-
}
\ 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/devrent/vo/DevRentPageReqVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentPageReqVO.java
index 275e74f..7bc89a0 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentPageReqVO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentPageReqVO.java
@@ -45,11 +45,8 @@
@Schema(description = "澶囨敞", example = "浣犵寽")
private String remark;
- @Schema(description = "鍙栨秷瀹夎")
- private Integer cancelled;
-
- @Schema(description = "閬楀け")
- private Integer lost;
+ @Schema(description = "鐘舵��")
+ private Integer state;
@Schema(description = "鍒涘缓鏃堕棿")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
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 d57c0ba..52c82fc 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
@@ -52,13 +52,9 @@
@ExcelProperty("澶囨敞")
private String remark;
- @Schema(description = "鍙栨秷瀹夎")
- @ExcelProperty("鍙栨秷瀹夎")
- private Integer cancelled;
-
- @Schema(description = "閬楀け")
- @ExcelProperty("鏄惁閬楀け")
- private Integer lost;
+ @Schema(description = "鐘舵��")
+ @ExcelProperty("鐘舵��")
+ private Integer state;
@Schema(description = "鍒涘缓鏃堕棿", requiredMode = Schema.RequiredMode.REQUIRED)
@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 3d938ae..1fc8f39 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
@@ -44,9 +44,6 @@
@Schema(description = "澶囨敞", example = "浣犵寽")
private String remark;
- @Schema(description = "鍙栨秷瀹夎")
- private Integer cancelled;
-
- @Schema(description = "閬楀け")
- private Integer lost;
-}
\ No newline at end of file
+ @Schema(description = "鐘舵��")
+ private Integer state;
+}
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 8d02275..5867d9c 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
@@ -27,9 +27,6 @@
@Schema(description = "鎮h�呭悕绉�", example = "鑺嬭壙")
private String patName;
- @Schema(description = "鍙栨秷瀹夎")
- private Integer cancelled;
-
- @Schema(description = "閬楀け")
- private Integer lost;
+ @Schema(description = "鐘舵��")
+ private Integer state;
}
\ 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/JobRecordPageReqVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/vo/JobRecordPageReqVO.java
index 34ee4e7..386dcf9 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/vo/JobRecordPageReqVO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/vo/JobRecordPageReqVO.java
@@ -17,7 +17,7 @@
public class JobRecordPageReqVO extends PageParam {
@Schema(description = "浣滀笟绫诲瀷", example = "1")
- private Integer jobType;
+ private Integer[] jobType;
@Schema(description = "鍖荤敓缂栧彿", example = "24197")
private Long docId;
@@ -43,9 +43,6 @@
@Schema(description = "澶囨敞", example = "浣犵寽")
private String remark;
-
- @Schema(description = "鍙栨秷瀹夎")
- private Integer cancelled;
@Schema(description = "鍒涘缓鏃堕棿")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/vo/JobRecordRespVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/vo/JobRecordRespVO.java
index 2ff11b4..fde9212 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/vo/JobRecordRespVO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/vo/JobRecordRespVO.java
@@ -52,14 +52,6 @@
@ExcelProperty("澶囨敞")
private String remark;
- @Schema(description = "鍙栨秷瀹夎")
- @ExcelProperty("鍙栨秷瀹夎")
- private Integer cancelled;
-
- @Schema(description = "閬楀け")
- @ExcelProperty("鏄惁閬楀け")
- private Integer lost;
-
@Schema(description = "鍒涘缓鏃堕棿", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("鍒涘缓鏃堕棿")
private LocalDateTime createTime;
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 e63d7c3..76f545d 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
@@ -46,9 +46,4 @@
@NotNull(message = "瀵瑰簲绉熻祦缂栧彿涓嶈兘涓虹┖")
private Long rentId;
- @Schema(description = "鍙栨秷瀹夎")
- private Integer cancelled;
-
- @Schema(description = "閬楀け")
- private Integer lost;
}
\ 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/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 8533c86..644ac22 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
@@ -1,5 +1,6 @@
package cn.lihu.jh.module.ecg.dal.dataobject.devrent;
+import cn.lihu.jh.module.ecg.enums.DevRentStateEnum;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
@@ -32,6 +33,7 @@
/**
* 璁惧缂栧彿
*/
+ @TableField(updateStrategy = FieldStrategy.IGNORED)
private String devId;
/**
* 鎮h�呯紪鍙�
@@ -67,12 +69,7 @@
private String remark;
/**
- * 鏀惧純瀹夎
+ * @see DevRentStateEnum
*/
- private Integer cancelled;
-
- /**
- * 閬楀け
- */
- private Integer lost;
-}
\ No newline at end of file
+ private Integer state;
+}
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/jobrecord/JobRecordDO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/jobrecord/JobRecordDO.java
index 022a36a..b6bb350 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/jobrecord/JobRecordDO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/jobrecord/JobRecordDO.java
@@ -43,6 +43,7 @@
/**
* 璁惧缂栧彿
*/
+ @TableField(updateStrategy = FieldStrategy.IGNORED)
private String devId;
/**
* 鎮h�呯紪鍙�
@@ -64,16 +65,6 @@
* 澶囨敞
*/
private String remark;
-
- /**
- * 鏀惧純瀹夎
- */
- private Integer cancelled;
-
- /**
- * 閬楀け
- */
- private Integer lost;
/**
* 瀵瑰簲绉熻祦缂栧彿
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 3e075ac..c90ef5a 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,6 +10,7 @@
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
@@ -34,6 +35,8 @@
.orderByDesc(DevRentDO::getId));
}
- DevRentDO getLatestRent(DevRentSearchReqVO reqVO );
+ DevRentDO getDismantleRentByState(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/dal/mysql/jobrecord/JobRecordMapper.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/jobrecord/JobRecordMapper.java
index 0536dff..a366038 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/jobrecord/JobRecordMapper.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/jobrecord/JobRecordMapper.java
@@ -12,7 +12,6 @@
import cn.lihu.jh.module.ecg.controller.admin.jobrecord.vo.*;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
-import org.apache.ibatis.annotations.Update;
/**
* 宸ヤ綔璁板綍 Mapper
@@ -24,7 +23,8 @@
default PageResult<JobRecordDO> selectPage(JobRecordPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<JobRecordDO>()
- .eqIfPresent(JobRecordDO::getJobType, reqVO.getJobType())
+ //.eqIfPresent(JobRecordDO::getJobType, reqVO.getJobType())
+ .inIfPresent(JobRecordDO::getJobType, reqVO.getJobType())
.eqIfPresent(JobRecordDO::getDocId, reqVO.getDocId())
.likeIfPresent(JobRecordDO::getDocName, reqVO.getDocName())
.eqIfPresent(JobRecordDO::getDevId, reqVO.getDevId())
@@ -38,8 +38,8 @@
.orderByDesc(JobRecordDO::getId));
}
- @Select("SELECT * FROM lihu.job_record where rent_id=#{rentId} and job_type=#{jobType} and doc_id=#{docId} limit 1")
- JobRecordDO selectByRentIdJobTypeDocId(@Param("rentId") Long rentId, @Param("jobType") Integer jobType, @Param("docId") Long docId );
+ @Select("SELECT * FROM lihu.job_record where rent_id=#{rentId} and doc_id=#{docId} limit 1")
+ JobRecordDO selectByRentIdDocId(@Param("rentId") Long rentId, @Param("docId") Long docId );
@Select("SELECT count(1) FROM lihu.job_record where pat_id=#{patId} and TO_DAYS(job_time)=TO_DAYS(#{jobTime}) and job_type=#{jobType} ")
Integer getPatientJobNum(@Param("patId") String patId, @Param("jobTime") LocalDateTime jobTime, @Param("jobType") Integer jobType );
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 e6258d6..239a208 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
@@ -15,6 +15,14 @@
public interface DevRentService {
/**
+ * 瑁呮満鐧昏
+ *
+ * @param createReqVO 鍒涘缓淇℃伅
+ * @return 缂栧彿
+ */
+ CommonResult<Long> registerOperation(@Valid DevRentSaveReqVO createReqVO);
+
+ /**
* 瑁呮満
*
* @param createReqVO 鍒涘缓淇℃伅
@@ -84,5 +92,5 @@
*/
PageResult<DevRentDO> getDevRentPage(DevRentPageReqVO pageReqVO);
- DevRentDO getLatestRent(DevRentSearchReqVO searchReqVO);
+ DevRentDO getDismantleRent(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 b37420b..13638c9 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
@@ -7,11 +7,13 @@
import cn.lihu.jh.module.ecg.dal.dataobject.jobrecord.JobRecordDO;
import cn.lihu.jh.module.ecg.dal.mysql.devmanage.DeviceMapper;
import cn.lihu.jh.module.ecg.dal.mysql.jobrecord.JobRecordMapper;
+import cn.lihu.jh.module.ecg.enums.DevRentStateEnum;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
+import java.util.List;
import cn.lihu.jh.module.ecg.controller.admin.devrent.vo.*;
import cn.lihu.jh.module.ecg.dal.dataobject.devrent.DevRentDO;
@@ -44,6 +46,12 @@
DeviceMapper deviceMapper;
@Override
+ public CommonResult<Long> registerOperation(DevRentSaveReqVO createReqVO) {
+ Long rent_id = createDevRent(createReqVO);
+ return CommonResult.success(rent_id);
+ }
+
+ @Override
@Transactional
public CommonResult<Long> installOperation(DevRentSaveReqVO createReqVO) {
Long userId = SecurityFrameworkUtils.getLoginUserId();
@@ -57,14 +65,14 @@
Long rent_id = createReqVO.getId();
if (null == rent_id) {
-
- // 鍒ゆ柇鏄惁宸茬粡鏈夎鏈鸿褰�
- Integer recordNum = jobRecordMapper.getPatientJobNum(createReqVO.getPatId(), createReqVO.getRentTime(), 0);
- if (null != recordNum && recordNum > 0) {
+ List<DevRentDO> devRentDOList = devRentMapper.selectByPatIdAndState(createReqVO.getPatId(), DevRentStateEnum.FREE.getState());
+ if (devRentDOList.size() != 1)
return CommonResult.error(DEV_INSTALL_EXIST);
- }
- rent_id = createDevRent(createReqVO);
+ rent_id = devRentDOList.getFirst().getId();
+ createReqVO.setId( rent_id );
+ createReqVO.setState( DevRentStateEnum.INSTALLED.getState() );
+ updateDevRent( createReqVO );
JobRecordSaveReqVO jobRecordSaveReqVO = new JobRecordSaveReqVO();
jobRecordSaveReqVO.setRentId(rent_id);
@@ -74,7 +82,7 @@
jobRecordSaveReqVO.setPatId(createReqVO.getPatId());
jobRecordSaveReqVO.setPatName(createReqVO.getPatName());
jobRecordSaveReqVO.setJobTime(createReqVO.getRentTime());
- jobRecordSaveReqVO.setJobType(0);
+ jobRecordSaveReqVO.setJobType( DevRentStateEnum.INSTALLED.getState() );
jobRecordSaveReqVO.setRemark(createReqVO.getRemark());
jobRecordSaveReqVO.setSummary("");
@@ -82,14 +90,14 @@
jobRecordMapper.insert(jobRecord);
} else {
// 鎾ら攢 鏀惧純鎿嶄綔
- createReqVO.setCancelled(0);
+ createReqVO.setState( DevRentStateEnum.INSTALLED.getState() );
updateDevRent( createReqVO );
- JobRecordDO jobRecordDO = jobRecordMapper.selectByRentIdJobTypeDocId(rent_id, 0, userId);
+ JobRecordDO jobRecordDO = jobRecordMapper.selectByRentIdDocId(rent_id, userId);
if (null != jobRecordDO) {
- jobRecordDO.setCancelled( createReqVO.getCancelled() );
jobRecordDO.setDevId(createReqVO.getDevId());
+ jobRecordDO.setJobType( DevRentStateEnum.INSTALLED.getState() );
jobRecordDO.setJobTime(createReqVO.getRentTime());
jobRecordDO.setRemark(createReqVO.getRemark());
jobRecordDO.setUpdater(String.valueOf(userId));
@@ -103,15 +111,13 @@
@Override
@Transactional
public Long dismantleOperation(DevRentSaveReqVO updateReqVO) {
- // 鍙栨秷閬楀け鏍囪
- updateReqVO.setLost(0);
-
+ updateReqVO.setState( DevRentStateEnum.DISMANTLED.getState() );
updateDevRent( updateReqVO );
Long userId = SecurityFrameworkUtils.getLoginUserId();
String userNickname = SecurityFrameworkUtils.getLoginUserNickname();
- JobRecordDO jobRecordDO = jobRecordMapper.selectByRentIdJobTypeDocId(updateReqVO.getId(), 1, userId);
+ JobRecordDO jobRecordDO = jobRecordMapper.selectByRentIdDocId(updateReqVO.getId(), userId);
if (jobRecordDO == null) {
JobRecordSaveReqVO jobRecordSaveReqVO = new JobRecordSaveReqVO();
jobRecordSaveReqVO.setRentId( updateReqVO.getId() );
@@ -121,7 +127,7 @@
jobRecordSaveReqVO.setPatId( updateReqVO.getPatId() );
jobRecordSaveReqVO.setPatName( updateReqVO.getPatName() );
jobRecordSaveReqVO.setJobTime( updateReqVO.getReturnTime() );
- jobRecordSaveReqVO.setJobType( 1 );
+ jobRecordSaveReqVO.setJobType( DevRentStateEnum.DISMANTLED.getState() );
jobRecordSaveReqVO.setRemark( updateReqVO.getRemark() );
jobRecordSaveReqVO.setSummary( updateReqVO.getInterference() + " " + updateReqVO.getBaseline() + " " + updateReqVO.getDetachment() );
JobRecordDO jobRecord = BeanUtils.toBean(jobRecordSaveReqVO, JobRecordDO.class);
@@ -130,9 +136,7 @@
// 璁惧閬楀け鏃�, 闇�鎭㈠鍒版甯�
resumeDevLost( updateReqVO );
- // 鍙栨秷閬楀け鏍囪
- jobRecordDO.setLost(0);
-
+ jobRecordDO.setJobType( DevRentStateEnum.DISMANTLED.getState() );
jobRecordDO.setJobTime( updateReqVO.getReturnTime() );
jobRecordDO.setRemark( updateReqVO.getRemark() );
jobRecordDO.setSummary( updateReqVO.getInterference() + " " + updateReqVO.getBaseline() + " " + updateReqVO.getDetachment() );
@@ -150,29 +154,30 @@
Long userId = SecurityFrameworkUtils.getLoginUserId();
String userNickname = SecurityFrameworkUtils.getLoginUserNickname();
- createReqVO.setCancelled(1);
+ createReqVO.setDevId(null);
+ createReqVO.setState( DevRentStateEnum.CANCELLED.getState() );
Long rent_id = createReqVO.getId();
if (null == rent_id) {
- // 鍒ゆ柇鏄惁宸茬粡鏈夋媶鏈鸿褰�
- Integer recordNum = jobRecordMapper.getPatientJobNum(createReqVO.getPatId(), createReqVO.getRentTime(), 0);
- if (null != recordNum && recordNum > 0) {
+ List<DevRentDO> devRentDOList = devRentMapper.selectByPatIdAndState(createReqVO.getPatId(), DevRentStateEnum.FREE.getState());
+ if (devRentDOList.size() != 1)
return CommonResult.error(DEV_INSTALL_EXIST);
- }
- rent_id = createDevRent(createReqVO);
+ rent_id = devRentDOList.getFirst().getId();
+ createReqVO.setId( rent_id );
+ createReqVO.setState( DevRentStateEnum.CANCELLED.getState() );
+ updateDevRent( createReqVO );
JobRecordSaveReqVO jobRecordSaveReqVO = new JobRecordSaveReqVO();
jobRecordSaveReqVO.setRentId(rent_id);
- //jobRecordSaveReqVO.setDevId(createReqVO.getDevId());
+ jobRecordSaveReqVO.setDevId(null);
jobRecordSaveReqVO.setDocId(userId);
jobRecordSaveReqVO.setDocName(userNickname);
jobRecordSaveReqVO.setPatId(createReqVO.getPatId());
jobRecordSaveReqVO.setPatName(createReqVO.getPatName());
+ jobRecordSaveReqVO.setJobType( DevRentStateEnum.CANCELLED.getState() );
jobRecordSaveReqVO.setJobTime(createReqVO.getRentTime());
- jobRecordSaveReqVO.setJobType(0);
- jobRecordSaveReqVO.setCancelled(1);
jobRecordSaveReqVO.setRemark(createReqVO.getRemark());
jobRecordSaveReqVO.setSummary("");
@@ -181,11 +186,11 @@
} else {
updateDevRent( createReqVO );
- JobRecordDO jobRecordDO = jobRecordMapper.selectByRentIdJobTypeDocId(rent_id, 0, userId);
+ JobRecordDO jobRecordDO = jobRecordMapper.selectByRentIdDocId(rent_id, userId);
if (null != jobRecordDO) {
- //jobRecordDO.setDevId(createReqVO.getDevId());
+ jobRecordDO.setDevId(null);
+ jobRecordDO.setJobType( DevRentStateEnum.CANCELLED.getState() );
jobRecordDO.setJobTime(createReqVO.getRentTime());
- jobRecordDO.setCancelled(1);
jobRecordDO.setRemark(createReqVO.getRemark());
jobRecordDO.setUpdater(String.valueOf(userId));
jobRecordDO.setUpdateTime(LocalDateTime.now());
@@ -198,13 +203,13 @@
@Override
@Transactional
public CommonResult<Long> loseOperation(DevRentSaveReqVO updateReqVO) {
- updateReqVO.setLost(1);
+ updateReqVO.setState( DevRentStateEnum.LOST.getState() );
updateDevRent( updateReqVO );
Long userId = SecurityFrameworkUtils.getLoginUserId();
String userNickname = SecurityFrameworkUtils.getLoginUserNickname();
- JobRecordDO jobRecordDO = jobRecordMapper.selectByRentIdJobTypeDocId(updateReqVO.getId(), 1, userId);
+ JobRecordDO jobRecordDO = jobRecordMapper.selectByRentIdDocId(updateReqVO.getId(), userId);
if (jobRecordDO == null) {
JobRecordSaveReqVO jobRecordSaveReqVO = new JobRecordSaveReqVO();
jobRecordSaveReqVO.setRentId( updateReqVO.getId() );
@@ -214,14 +219,13 @@
jobRecordSaveReqVO.setPatId( updateReqVO.getPatId() );
jobRecordSaveReqVO.setPatName( updateReqVO.getPatName() );
jobRecordSaveReqVO.setJobTime( updateReqVO.getReturnTime() );
- jobRecordSaveReqVO.setJobType( 1 );
- jobRecordSaveReqVO.setLost( updateReqVO.getLost() );
+ jobRecordSaveReqVO.setJobType( DevRentStateEnum.LOST.getState() );
jobRecordSaveReqVO.setRemark( updateReqVO.getRemark() );
jobRecordSaveReqVO.setSummary( updateReqVO.getInterference() + " " + updateReqVO.getBaseline() + " " + updateReqVO.getDetachment() );
JobRecordDO jobRecord = BeanUtils.toBean(jobRecordSaveReqVO, JobRecordDO.class);
jobRecordMapper.insert(jobRecord);
} else {
- jobRecordDO.setLost( updateReqVO.getLost() );
+ jobRecordDO.setJobType( DevRentStateEnum.LOST.getState() );
jobRecordDO.setJobTime( updateReqVO.getReturnTime() );
jobRecordDO.setRemark( updateReqVO.getRemark() );
jobRecordDO.setSummary( updateReqVO.getInterference() + " " + updateReqVO.getBaseline() + " " + updateReqVO.getDetachment() );
@@ -281,8 +285,8 @@
}
@Override
- public DevRentDO getLatestRent(DevRentSearchReqVO searchReqVO) {
- return devRentMapper.getLatestRent(searchReqVO);
+ public DevRentDO getDismantleRent(DevRentSearchReqVO searchReqVO) {
+ return devRentMapper.getDismantleRentByState(searchReqVO);
}
private void markDevLost(DevRentSaveReqVO createReqVO) {
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceImpl.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceImpl.java
index aa243de..7153832 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceImpl.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceImpl.java
@@ -6,9 +6,13 @@
import javax.annotation.Resource;
import cn.lihu.jh.module.ecg.controller.admin.room.vo.MonitorInfoVO;
+import cn.lihu.jh.module.ecg.dal.dataobject.devrent.DevRentDO;
import cn.lihu.jh.module.ecg.dal.mysql.call.CallMapper;
+import cn.lihu.jh.module.ecg.dal.mysql.devrent.DevRentMapper;
+import cn.lihu.jh.module.ecg.enums.DevRentStateEnum;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import org.springframework.validation.annotation.Validated;
@@ -50,6 +54,9 @@
@Resource
private CallMapper callMapper;
+
+ @Resource
+ private DevRentMapper devRentMapper;
AtomicInteger openingFlag = new AtomicInteger(0);
AtomicInteger curSeqNum = new AtomicInteger(0);
@@ -583,11 +590,16 @@
* @param queueSaveReqVO
*/
@Override
+ @Transactional
public void queue(QueueSaveReqVO queueSaveReqVO) {
queueSaveReqVO.setStatus(QueueStatusEnum.WAITING.getStatus()); //鎺掗槦涓�
QueueDO queue = BeanUtils.toBean(queueSaveReqVO, QueueDO.class);
queueMapper.insert(queue);
+ DevRentDO devRent = BeanUtils.toBean(queueSaveReqVO, DevRentDO.class);
+ devRent.setState( DevRentStateEnum.FREE.getState() );
+ devRentMapper.insert(devRent);
+
startHurryUp();
}
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 7d7380e..0288321 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,9 +9,12 @@
鏂囨。鍙锛歨ttps://www.iocoder.cn/MyBatis/x-plugins/
-->
- <select id="getLatestRent" resultType="cn.lihu.jh.module.ecg.dal.dataobject.devrent.DevRentDO">
+ <select id="getDismantleRentByState" resultType="cn.lihu.jh.module.ecg.dal.dataobject.devrent.DevRentDO">
select * from lihu.dev_rent
<where>
+ <if test="state != null">
+ and state = #{state}
+ </if>
<if test="devId != null and devId != ''">
and dev_id = #{devId}
</if>
@@ -19,7 +22,7 @@
and pat_id = #{patId}
</if>
</where>
- order by rent_time desc limit 1
+ limit 1
</select>
</mapper>
\ No newline at end of file
--
Gitblit v1.9.3