From 472979c8d2339ab8f4f22a4a04a11cebbeded7ac Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期四, 12 九月 2024 17:51:20 +0800
Subject: [PATCH] 撤销装机功能
---
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/vo/JobRecordRespVO.java | 4 +
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentRespVO.java | 4 +
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentService.java | 12 ++
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevCancelReqVO.java | 48 ++++++++++++
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentSaveReqVO.java | 3
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/devrent/DevRentDO.java | 1
sql/mysql/jh.sql | 11 +-
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java | 67 ++++++++++++++++
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/vo/JobRecordPageReqVO.java | 4 +
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/jobrecord/JobRecordMapper.java | 4 +
jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/ErrorCodeConstants.java | 3
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentPageReqVO.java | 3
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/jobrecord/JobRecordDO.java | 3
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/DevRentController.java | 40 ++++++----
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/vo/JobRecordSaveReqVO.java | 2
15 files changed, 186 insertions(+), 23 deletions(-)
diff --git a/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/ErrorCodeConstants.java b/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/ErrorCodeConstants.java
index 24d25af..96dbf7f 100644
--- a/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/ErrorCodeConstants.java
+++ b/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/ErrorCodeConstants.java
@@ -28,6 +28,9 @@
ErrorCode DEV_RENT_NOT_EXISTS = new ErrorCode(1_010_005_002, "绉熷�熶笉瀛樺湪");
ErrorCode DEV_INSTALL_EXCEPTION = new ErrorCode(1_010_005_003, "瑁呮満鍐呴儴閿欒");
ErrorCode DEV_DISMANTLE_EXCEPTION = new ErrorCode(1_010_005_004, "鎷嗘満鍐呴儴閿欒");
+ ErrorCode DEV_CANCEL_EXCEPTION = new ErrorCode(1_010_005_005, "鎷嗘満鍐呴儴閿欒");
+ ErrorCode DEV_INSTALL_EXIST = new ErrorCode(1_010_005_006, "褰撳ぉ宸叉湁瑁呮満");
+ ErrorCode DEV_DISMANTLE_EXIST = new ErrorCode(1_010_005_006, "褰撳ぉ宸叉湁鎷嗘満");
ErrorCode JOB_RECORD_NOT_EXISTS = new ErrorCode(1_010_006_000, "宸ヤ綔璁板綍涓嶅瓨鍦�");
}
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 8e2dc08..a1bca10 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
@@ -17,16 +17,12 @@
import cn.lihu.jh.framework.common.pojo.CommonResult;
import cn.lihu.jh.framework.common.util.object.BeanUtils;
-import static cn.lihu.jh.framework.common.pojo.CommonResult.error;
-import static cn.lihu.jh.framework.common.pojo.CommonResult.success;
-
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 static cn.lihu.jh.framework.common.util.exception.ExceptionUtils.formatException;
-import static cn.lihu.jh.module.ecg.enums.ErrorCodeConstants.DEV_DISMANTLE_EXCEPTION;
-import static cn.lihu.jh.module.ecg.enums.ErrorCodeConstants.DEV_INSTALL_EXCEPTION;
+import static cn.lihu.jh.module.ecg.enums.ErrorCodeConstants.*;
import cn.lihu.jh.module.ecg.controller.admin.devrent.vo.*;
import cn.lihu.jh.module.ecg.dal.dataobject.devrent.DevRentDO;
@@ -51,12 +47,11 @@
@PreAuthorize("@ss.hasPermission('ecg:doctor:task')")
public CommonResult<Long> devInstall(@Valid @RequestBody DevRentSaveReqVO createReqVO) {
try {
- Long rent_id = devRentService.installOperation(createReqVO);
- return success(rent_id);
+ return devRentService.installOperation(createReqVO);
} catch ( RuntimeException runtimeException ) {
String err = ExceptionUtils.formatException( runtimeException );
log.error("devInstall: " + err);
- return error(DEV_INSTALL_EXCEPTION);
+ return CommonResult.error(DEV_INSTALL_EXCEPTION);
}
}
@@ -66,11 +61,24 @@
public CommonResult<Long> devDismantle(@Valid @RequestBody DevRentSaveReqVO createReqVO) {
try {
devRentService.dismantleOperation(createReqVO);
- return success(0L);
+ return CommonResult.success(0L);
} catch ( RuntimeException runtimeException ) {
String err = ExceptionUtils.formatException( runtimeException );
log.error("devDismantle: " + err);
- return error(DEV_DISMANTLE_EXCEPTION);
+ return CommonResult.error(DEV_DISMANTLE_EXCEPTION);
+ }
+ }
+
+ @PostMapping("/dev-cancel")
+ @Operation(summary = "鍙栨秷瑁呮満")
+ @PreAuthorize("@ss.hasPermission('ecg:doctor:task')")
+ public CommonResult<Long> devCancel(@Valid @RequestBody DevCancelReqVO cancelReqVO) {
+ try {
+ return devRentService.cancelOperation(cancelReqVO);
+ } catch ( RuntimeException runtimeException ) {
+ String err = ExceptionUtils.formatException( runtimeException );
+ log.error("devCancel: " + err);
+ return CommonResult.error(DEV_CANCEL_EXCEPTION);
}
}
@@ -78,7 +86,7 @@
@Operation(summary = "鍒涘缓瑁呮満鎷嗘満")
@PreAuthorize("@ss.hasPermission('ecg:doctor:task')")
public CommonResult<Long> createDevRent(@Valid @RequestBody DevRentSaveReqVO createReqVO) {
- return success(devRentService.createDevRent(createReqVO));
+ return CommonResult.success(devRentService.createDevRent(createReqVO));
}
@PutMapping("/update")
@@ -86,7 +94,7 @@
@PreAuthorize("@ss.hasPermission('ecg:doctor:task')")
public CommonResult<Boolean> updateDevRent(@Valid @RequestBody DevRentSaveReqVO updateReqVO) {
devRentService.updateDevRent(updateReqVO);
- return success(true);
+ return CommonResult.success(true);
}
@DeleteMapping("/delete")
@@ -95,7 +103,7 @@
@PreAuthorize("@ss.hasPermission('ecg:doctor:task')")
public CommonResult<Boolean> deleteDevRent(@RequestParam("id") Long id) {
devRentService.deleteDevRent(id);
- return success(true);
+ return CommonResult.success(true);
}
@GetMapping("/get")
@@ -104,7 +112,7 @@
@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));
+ return CommonResult.success(BeanUtils.toBean(devRent, DevRentRespVO.class));
}
@GetMapping("/page")
@@ -112,7 +120,7 @@
@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));
+ return CommonResult.success(BeanUtils.toBean(pageResult, DevRentRespVO.class));
}
@GetMapping("/export-excel")
@@ -135,6 +143,6 @@
public CommonResult<DevRentRespVO> getLatestRent( @RequestParam("dev-id") String devId )
{
DevRentDO devRent = devRentService.getLatestRent( devId );
- return success(BeanUtils.toBean(devRent, DevRentRespVO.class));
+ return CommonResult.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/DevCancelReqVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevCancelReqVO.java
new file mode 100644
index 0000000..e44776e
--- /dev/null
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevCancelReqVO.java
@@ -0,0 +1,48 @@
+package cn.lihu.jh.module.ecg.controller.admin.devrent.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import javax.validation.constraints.NotEmpty;
+import java.time.LocalDateTime;
+
+@Schema(description = "绠$悊鍚庡彴 - 鍙栨秷瑁呮満 Request VO")
+@Data
+public class DevCancelReqVO {
+
+ @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "26525")
+ private Long id;
+
+ @Schema(description = "璁惧缂栧彿", requiredMode = Schema.RequiredMode.REQUIRED, example = "3986")
+ private String devId;
+
+ @Schema(description = "鎮h�呯紪鍙�", requiredMode = Schema.RequiredMode.REQUIRED, example = "4973")
+ @NotEmpty(message = "鎮h�呯紪鍙蜂笉鑳戒负绌�")
+ private String patId;
+
+ @Schema(description = "鎮h�呭悕绉�", requiredMode = Schema.RequiredMode.REQUIRED, example = "鑺嬭壙")
+ @NotEmpty(message = "鎮h�呭悕绉颁笉鑳戒负绌�")
+ private String patName;
+
+ @Schema(description = "瑁呮満鏃堕棿")
+ private LocalDateTime rentTime;
+
+ @Schema(description = "鎷嗘満鏃堕棿")
+ private LocalDateTime returnTime;
+
+ @Schema(description = "骞叉壈鏁�")
+ private Integer interference;
+
+ @Schema(description = "鍩虹嚎绮�")
+ private String baseline;
+
+ @Schema(description = "鑴辩")
+ private String detachment;
+
+ @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 e0f6798..ff4aa83 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
@@ -44,6 +44,9 @@
@Schema(description = "澶囨敞", example = "浣犵寽")
private String remark;
+ @Schema(description = "鍙栨秷瀹夎")
+ private Integer cancelled;
+
@Schema(description = "鍒涘缓鏃堕棿")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
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 fb16cb0..7ab2796 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,6 +52,10 @@
@ExcelProperty("澶囨敞")
private String remark;
+ @Schema(description = "鍙栨秷瀹夎")
+ @ExcelProperty("鍙栨秷瀹夎")
+ private Integer cancelled;
+
@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/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 6a54acd..c83c0e0 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
@@ -43,4 +43,7 @@
@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/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 9b69342..34ee4e7 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
@@ -1,5 +1,6 @@
package cn.lihu.jh.module.ecg.controller.admin.jobrecord.vo;
+import com.alibaba.excel.annotation.ExcelProperty;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
@@ -43,6 +44,9 @@
@Schema(description = "澶囨敞", example = "浣犵寽")
private String remark;
+ @Schema(description = "鍙栨秷瀹夎")
+ private Integer cancelled;
+
@Schema(description = "鍒涘缓鏃堕棿")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
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/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 fde9212..23a4ac0 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,6 +52,10 @@
@ExcelProperty("澶囨敞")
private String remark;
+ @Schema(description = "鍙栨秷瀹夎")
+ @ExcelProperty("鍙栨秷瀹夎")
+ private Integer cancelled;
+
@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 76f545d..7ae3155 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,4 +46,6 @@
@NotNull(message = "瀵瑰簲绉熻祦缂栧彿涓嶈兘涓虹┖")
private Long rentId;
+ @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/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 8bcd9af..eeca1de 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
@@ -66,4 +66,5 @@
*/
private String remark;
+ 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/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 2e54e7c..04278be 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
@@ -64,6 +64,9 @@
* 澶囨敞
*/
private String remark;
+
+ private Integer cancelled;
+
/**
* 瀵瑰簲绉熻祦缂栧彿
*/
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 dd41d33..26afeeb 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
@@ -1,5 +1,6 @@
package cn.lihu.jh.module.ecg.dal.mysql.jobrecord;
+import java.time.LocalDateTime;
import java.util.*;
import cn.lihu.jh.framework.common.pojo.PageResult;
@@ -38,4 +39,7 @@
@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 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 );
}
\ 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 4b1e791..f1e640d 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
@@ -1,6 +1,8 @@
package cn.lihu.jh.module.ecg.service.devrent;
import java.util.*;
+
+import cn.lihu.jh.framework.common.pojo.CommonResult;
import cn.lihu.jh.module.ecg.controller.admin.devrent.vo.*;
import cn.lihu.jh.module.ecg.dal.dataobject.devrent.DevRentDO;
import cn.lihu.jh.framework.common.pojo.PageResult;
@@ -21,7 +23,7 @@
* @param createReqVO 鍒涘缓淇℃伅
* @return 缂栧彿
*/
- Long installOperation(@Valid DevRentSaveReqVO createReqVO);
+ CommonResult<Long> installOperation(@Valid DevRentSaveReqVO createReqVO);
/**
* 鎷嗘満
@@ -32,6 +34,14 @@
Long dismantleOperation(@Valid DevRentSaveReqVO createReqVO);
/**
+ * 瑁呮満
+ *
+ * @param createReqVO 鍒涘缓淇℃伅
+ * @return 缂栧彿
+ */
+ CommonResult<Long> cancelOperation(@Valid DevCancelReqVO createReqVO);
+
+ /**
* 鍒涘缓瑁呮満鎷嗘満
*
* @param createReqVO 鍒涘缓淇℃伅
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 3238445..445794c 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
@@ -1,5 +1,6 @@
package cn.lihu.jh.module.ecg.service.devrent;
+import cn.lihu.jh.framework.common.pojo.CommonResult;
import cn.lihu.jh.framework.security.core.util.SecurityFrameworkUtils;
import cn.lihu.jh.module.ecg.controller.admin.jobrecord.vo.JobRecordSaveReqVO;
import cn.lihu.jh.module.ecg.dal.dataobject.jobrecord.JobRecordDO;
@@ -40,12 +41,19 @@
@Override
@Transactional
- public Long installOperation(DevRentSaveReqVO createReqVO) {
+ public CommonResult<Long> installOperation(DevRentSaveReqVO createReqVO) {
Long userId = SecurityFrameworkUtils.getLoginUserId();
String userNickname = SecurityFrameworkUtils.getLoginUserNickname();
Long rent_id = createReqVO.getId();
if (null == rent_id) {
+
+ // 鍒ゆ柇鏄惁宸茬粡鏈夎鏈鸿褰�
+ Integer recordNum = jobRecordMapper.getPatientJobNum(createReqVO.getPatId(), createReqVO.getRentTime(), 0);
+ if (null != recordNum && recordNum > 0) {
+ return CommonResult.error(DEV_INSTALL_EXIST);
+ }
+
rent_id = createDevRent(createReqVO);
JobRecordSaveReqVO jobRecordSaveReqVO = new JobRecordSaveReqVO();
@@ -63,10 +71,14 @@
JobRecordDO jobRecord = BeanUtils.toBean(jobRecordSaveReqVO, JobRecordDO.class);
jobRecordMapper.insert(jobRecord);
} else {
+ // 鎾ら攢 鏀惧純鎿嶄綔
+ createReqVO.setCancelled(0);
+
updateDevRent( createReqVO );
JobRecordDO jobRecordDO = jobRecordMapper.selectByRentIdJobTypeDocId(rent_id, 0, userId);
if (null != jobRecordDO) {
+ jobRecordDO.setCancelled( createReqVO.getCancelled() );
jobRecordDO.setDevId(createReqVO.getDevId());
jobRecordDO.setJobTime(createReqVO.getRentTime());
jobRecordDO.setRemark(createReqVO.getRemark());
@@ -75,7 +87,7 @@
jobRecordMapper.updateById(jobRecordDO);
}
}
- return rent_id;
+ return CommonResult.success(rent_id);
}
@Override
@@ -113,6 +125,57 @@
}
@Override
+ public CommonResult<Long> cancelOperation(DevCancelReqVO cancelReqVO) {
+ DevRentSaveReqVO createReqVO = BeanUtils.toBean(cancelReqVO, DevRentSaveReqVO.class);
+ Long userId = SecurityFrameworkUtils.getLoginUserId();
+ String userNickname = SecurityFrameworkUtils.getLoginUserNickname();
+
+ createReqVO.setCancelled(1);
+
+ Long rent_id = createReqVO.getId();
+ if (null == rent_id) {
+
+ // 鍒ゆ柇鏄惁宸茬粡鏈夋媶鏈鸿褰�
+ Integer recordNum = jobRecordMapper.getPatientJobNum(createReqVO.getPatId(), createReqVO.getRentTime(), 0);
+ if (null != recordNum && recordNum > 0) {
+ return CommonResult.error(DEV_INSTALL_EXIST);
+ }
+
+ rent_id = createDevRent(createReqVO);
+
+ JobRecordSaveReqVO jobRecordSaveReqVO = new JobRecordSaveReqVO();
+ jobRecordSaveReqVO.setRentId(rent_id);
+ //jobRecordSaveReqVO.setDevId(createReqVO.getDevId());
+ jobRecordSaveReqVO.setDocId(userId);
+ jobRecordSaveReqVO.setDocName(userNickname);
+ jobRecordSaveReqVO.setPatId(createReqVO.getPatId());
+ jobRecordSaveReqVO.setPatName(createReqVO.getPatName());
+ jobRecordSaveReqVO.setJobTime(createReqVO.getRentTime());
+ jobRecordSaveReqVO.setJobType(0);
+ jobRecordSaveReqVO.setCancelled(1);
+ jobRecordSaveReqVO.setRemark(createReqVO.getRemark());
+ jobRecordSaveReqVO.setSummary("");
+
+ JobRecordDO jobRecord = BeanUtils.toBean(jobRecordSaveReqVO, JobRecordDO.class);
+ jobRecordMapper.insert(jobRecord);
+ } else {
+ updateDevRent( createReqVO );
+
+ JobRecordDO jobRecordDO = jobRecordMapper.selectByRentIdJobTypeDocId(rent_id, 0, userId);
+ if (null != jobRecordDO) {
+ //jobRecordDO.setDevId(createReqVO.getDevId());
+ jobRecordDO.setJobTime(createReqVO.getRentTime());
+ jobRecordDO.setCancelled(1);
+ jobRecordDO.setRemark(createReqVO.getRemark());
+ jobRecordDO.setUpdater(String.valueOf(userId));
+ jobRecordDO.setUpdateTime(LocalDateTime.now());
+ jobRecordMapper.updateById(jobRecordDO);
+ }
+ }
+ return CommonResult.success(rent_id);
+ }
+
+ @Override
public Long createDevRent(DevRentSaveReqVO createReqVO) {
//
diff --git a/sql/mysql/jh.sql b/sql/mysql/jh.sql
index 0296ce6..6c5e132 100644
--- a/sql/mysql/jh.sql
+++ b/sql/mysql/jh.sql
@@ -141,15 +141,16 @@
DROP TABLE IF EXISTS `dev_rent`;
CREATE TABLE `dev_rent` (
`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�呭悕绉�',
+ `dev_id` varchar(45) DEFAULT NULL COMMENT '璁惧缂栧彿',
`rent_time` datetime DEFAULT NULL COMMENT '瑁呮満鏃堕棿',
`return_time` datetime DEFAULT NULL COMMENT '鎷嗘満鏃堕棿',
`interference` int DEFAULT NULL COMMENT '骞叉壈鏁�',
`baseline` varchar(100) DEFAULT NULL COMMENT '鍩虹嚎绮�',
`detachment` varchar(100) DEFAULT NULL COMMENT '鑴辩',
`remark` varchar(100) DEFAULT NULL COMMENT '澶囨敞',
+ `cancelled` int DEFAULT '0' COMMENT '鏈畨瑁�',
`tenant_id` int DEFAULT '1' COMMENT '绉熸埛缂栧彿',
`creator` varchar(10) DEFAULT '' COMMENT '鍒涘缓鑰�',
`create_time` datetime NOT NULL COMMENT '鍒涘缓鏃堕棿',
@@ -158,7 +159,7 @@
`deleted` bit(1) DEFAULT b'0' COMMENT '鍒犻櫎鏍囪',
PRIMARY KEY (`id`),
KEY `indx_dev_rent` (`dev_id`,`rent_time`) USING BTREE
-) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='瑁呮満鎷嗘満琛�';
+) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='瑁呮満鎷嗘満琛�';
-- ----------------------------
-- Table structure for job_record
@@ -176,6 +177,7 @@
`job_time` datetime DEFAULT NULL COMMENT '浣滀笟鏃堕棿',
`summary` varchar(200) DEFAULT NULL COMMENT '浣滀笟姒傝',
`remark` varchar(100) DEFAULT NULL COMMENT '澶囨敞',
+ `cancelled` int DEFAULT '0' COMMENT '鏈畨瑁�',
`tenant_id` int DEFAULT '1' COMMENT '绉熸埛缂栧彿',
`creator` varchar(10) DEFAULT '' COMMENT '鍒涘缓鑰�',
`create_time` datetime NOT NULL COMMENT '鍒涘缓鏃堕棿',
@@ -183,6 +185,7 @@
`update_time` datetime NOT NULL COMMENT '鏇存柊鏃堕棿',
`deleted` bit(1) DEFAULT b'0' COMMENT '鍒犻櫎鏍囪',
PRIMARY KEY (`id`),
- UNIQUE KEY `uni_rent_job_doc` (`rent_id`,`job_type`,`doc_id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='宸ヤ綔璁板綍琛�';
+ KEY `idx_pat_job` (`pat_id`,`job_time`,`job_type`),
+ KEY `idx_rent_id` (`rent_id`)
+) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='宸ヤ綔璁板綍琛�';
--
Gitblit v1.9.3