From 299e15ecf360734f77072d9df64afcd764154501 Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期一, 14 十月 2024 16:42:31 +0800
Subject: [PATCH] 常规检查 放弃功能
---
jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/ErrorCodeConstants.java | 6 ++
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentService.java | 9 ++++
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/DevRentController.java | 22 +++++++++--
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java | 58 ++++++++++++++++++++++++++++
4 files changed, 89 insertions(+), 6 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 8292a65..79d042e 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
@@ -35,12 +35,16 @@
ErrorCode DEV_INSTALL_NOT_EXISTS = new ErrorCode(1_010_006_000, "瑁呮満涓嶅瓨鍦�");
ErrorCode DEV_INSTALL_EXCEPTION = new ErrorCode(1_010_006_001, "瑁呮満鍐呴儴閿欒");
ErrorCode DEV_DISMANTLE_EXCEPTION = new ErrorCode(1_010_006_002, "鎷嗘満鍐呴儴閿欒");
- ErrorCode DEV_CANCEL_EXCEPTION = new ErrorCode(1_010_006_003, "鍙栨秷瑁呮満鍐呴儴閿欒");
+ ErrorCode ROUTINE_CANCEL_EXCEPTION = new ErrorCode(1_010_006_003, "甯歌妫�鏌ュ彇娑堥敊璇�");
+ ErrorCode DEV_RECEIVE_CANCEL_EXCEPTION = new ErrorCode(1_010_006_004, "璁惧棰嗙敤鍙栨秷閿欒");
+ ErrorCode DEV_INSTALL_CANCEL_EXCEPTION = new ErrorCode(1_010_006_005, "璁惧瑁呮満鍙栨秷閿欒");
+
ErrorCode DEV_LOSE_EXCEPTION = new ErrorCode(1_010_006_004, "閬楀け鍐呴儴閿欒");
ErrorCode DEV_INSTALL_EXIST = new ErrorCode(1_010_006_005, "褰撳ぉ宸叉湁瑁呮満");
ErrorCode DEV_DISMANTLE_EXIST = new ErrorCode(1_010_006_006, "褰撳ぉ宸叉湁鎷嗘満");
ErrorCode DEV_INSTALL_NOT_APPOINTMENT = new ErrorCode(1_010_006_007, "璇峰厛棰勭害纭");
ErrorCode DEV_INSTALL_NOT_RECEIVED = new ErrorCode(1_010_006_008, "璇峰厛棰嗙敤璁惧");
+ ErrorCode ROUTINE_CHECK_EXIST = new ErrorCode(1_010_006_009, "褰撳ぉ宸叉湁妫�鏌�");
ErrorCode JOB_RECORD_NOT_EXISTS = new ErrorCode(1_010_007_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 6d32f25..757f2d8 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
@@ -120,6 +120,20 @@
}
}
+
+ @PostMapping("/routine-check-cancel")
+ @Operation(summary = "鍙栨秷甯歌妫�鏌�")
+ @PreAuthorize("@ss.hasPermission('ecg:doctor:task')")
+ public CommonResult<Long> routineCheckCancel(@Valid @RequestBody DevCancelReqVO cancelReqVO) {
+ try {
+ return devRentService.cancelRoutineOperation(cancelReqVO);
+ } catch ( RuntimeException runtimeException ) {
+ String err = ExceptionUtils.formatException( runtimeException );
+ log.error("routineCheckCancel: " + err);
+ return CommonResult.error(ROUTINE_CANCEL_EXCEPTION);
+ }
+ }
+
@PostMapping("/dev-ready-cancel")
@Operation(summary = "鍙栨秷棰嗙敤")
@PreAuthorize("@ss.hasPermission('ecg:doctor:task')")
@@ -128,8 +142,8 @@
return devRentService.cancelReadyOperation(cancelReqVO);
} catch ( RuntimeException runtimeException ) {
String err = ExceptionUtils.formatException( runtimeException );
- log.error("devCancel: " + err);
- return CommonResult.error(DEV_CANCEL_EXCEPTION);
+ log.error("devReadyCancel: " + err);
+ return CommonResult.error(DEV_RECEIVE_CANCEL_EXCEPTION);
}
}
@@ -141,8 +155,8 @@
return devRentService.cancelInstallOperation(cancelReqVO);
} catch ( RuntimeException runtimeException ) {
String err = ExceptionUtils.formatException( runtimeException );
- log.error("devCancel: " + err);
- return CommonResult.error(DEV_CANCEL_EXCEPTION);
+ log.error("devInstallCancel: " + err);
+ return CommonResult.error(DEV_INSTALL_CANCEL_EXCEPTION);
}
}
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 ecc8a64..5753b72 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
@@ -62,6 +62,15 @@
*/
Long dataEntryOperation(@Valid DevRentSaveReqVO createReqVO);
+
+ /**
+ * 甯歌妫�鏌� 鍙栨秷
+ *
+ * @param cancelReqVO 鍒涘缓淇℃伅
+ * @return 缂栧彿
+ */
+ CommonResult<Long> cancelRoutineOperation(@Valid DevCancelReqVO cancelReqVO);
+
/**
* 鍙栨秷棰嗙敤
*
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 a933ea8..0c8852d 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
@@ -103,7 +103,7 @@
List<Integer> jobTypeList = new ArrayList<Integer>();
jobTypeList.add( DevRentStateEnum.ROUTINE_FINISH.getState());
- jobTypeList.add( DevRentStateEnum.READY_CANCELLED.getState());
+ jobTypeList.add( DevRentStateEnum.ROUTINE_CANCELLED.getState());
JobRecordDO jobRecordDO = jobRecordMapper.selectByRentIdDocId(rent_id, userId, jobTypeList);
if (null != jobRecordDO) {
jobRecordDO.setDevId(createReqVO.getDevId());
@@ -338,6 +338,62 @@
return updateReqVO.getId();
}
+ // 甯歌妫�鏌� 鍙栨秷
+ @Override
+ @Transactional
+ public CommonResult<Long> cancelRoutineOperation(DevCancelReqVO cancelReqVO) {
+ Long userId = SecurityFrameworkUtils.getLoginUserId();
+ String userNickname = SecurityFrameworkUtils.getLoginUserNickname();
+
+ DevRentSaveReqVO createReqVO = BeanUtils.toBean(cancelReqVO, DevRentSaveReqVO.class);
+ createReqVO.setDevId(null);
+ createReqVO.setState( DevRentStateEnum.ROUTINE_CANCELLED.getState());
+
+ Long rent_id = createReqVO.getId();
+ if (null == rent_id) {
+ List<DevRentDO> devRentDOList = devRentMapper.selectByPatIdAndState(createReqVO.getPatId(), DevRentStateEnum.FREE.getState());
+ if (devRentDOList.size() != 1)
+ return CommonResult.error(ROUTINE_CHECK_EXIST);
+
+ rent_id = devRentDOList.getFirst().getId();
+ createReqVO.setId( rent_id );
+ createReqVO.setState( DevRentStateEnum.ROUTINE_CANCELLED.getState() );
+ updateDevRent( createReqVO );
+
+ JobRecordSaveReqVO jobRecordSaveReqVO = new JobRecordSaveReqVO();
+ jobRecordSaveReqVO.setRentId(rent_id);
+ jobRecordSaveReqVO.setDevId(null);
+ jobRecordSaveReqVO.setDocId(userId);
+ jobRecordSaveReqVO.setDocName(userNickname);
+ jobRecordSaveReqVO.setPatId(createReqVO.getPatId());
+ jobRecordSaveReqVO.setPatName(createReqVO.getPatName());
+ jobRecordSaveReqVO.setJobType( DevRentStateEnum.ROUTINE_CANCELLED.getState() );
+ jobRecordSaveReqVO.setJobTime(createReqVO.getRentTime());
+ jobRecordSaveReqVO.setRemark(createReqVO.getRemark());
+ jobRecordSaveReqVO.setSummary("");
+
+ JobRecordDO jobRecord = BeanUtils.toBean(jobRecordSaveReqVO, JobRecordDO.class);
+ jobRecordMapper.insert(jobRecord);
+ } else {
+ updateDevRent( createReqVO );
+
+ List<Integer> jobTypeList = new ArrayList<Integer>();
+ jobTypeList.add( DevRentStateEnum.ROUTINE_FINISH.getState());
+ jobTypeList.add( DevRentStateEnum.ROUTINE_CANCELLED.getState());
+ JobRecordDO jobRecordDO = jobRecordMapper.selectByRentIdDocId(rent_id, userId, jobTypeList);
+ if (null != jobRecordDO) {
+ jobRecordDO.setDevId(null);
+ jobRecordDO.setJobType(DevRentStateEnum.ROUTINE_CANCELLED.getState());
+ jobRecordDO.setJobTime(createReqVO.getRentTime());
+ jobRecordDO.setRemark(createReqVO.getRemark());
+ jobRecordDO.setUpdater(String.valueOf(userId));
+ jobRecordDO.setUpdateTime(LocalDateTime.now());
+ jobRecordMapper.updateById(jobRecordDO);
+ }
+ }
+ return CommonResult.success(rent_id);
+ }
+
@Override
@Transactional
public CommonResult<Long> cancelReadyOperation(DevCancelReqVO cancelReqVO) {
--
Gitblit v1.9.3