From a3fcff07fc07bd35f41fd7f9b8f3a9df2676a581 Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期六, 12 十月 2024 18:42:44 +0800
Subject: [PATCH] 常规检查 叫号
---
jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/DevRentStateEnum.java | 4 +
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentService.java | 8 ++++
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceImpl.java | 15 +++++--
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/DevRentController.java | 17 ++++++++
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java | 62 +++++++++++++++++++++++++++++++
5 files changed, 100 insertions(+), 6 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 241470c..93ffab2 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
@@ -22,7 +22,9 @@
DATAENTERED(25, "宸插綍鍏�"),
READY_CANCELLED(30, "棰嗙敤鏀惧純"),
INSTALL_CANCELLED(35, "瀹夎鏀惧純"),
- LOST(40, "宸查仐澶�");
+ LOST(40, "宸查仐澶�"),
+ ROUTINE_CANCELLED(50, "甯歌妫�鏌ユ斁寮�"),
+ ROUTINE_FINISH( 60, "甯歌妫�鏌ュ畬鎴�");
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(DevRentStateEnum::getState).toArray();
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 bfe957c..abe1c41 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
@@ -50,6 +50,21 @@
@Resource
private QueueService queueService;
+ // 甯歌妫�鏌� 瀹屾垚
+ @PostMapping("/routine-finish")
+ @Operation(summary = "")
+ @PreAuthorize("@ss.hasPermission('ecg:doctor:task')")
+ public CommonResult<Long> routineFinish(@Valid @RequestBody DevRentSaveReqVO createReqVO) {
+ try {
+ CommonResult<Long> result = devRentService.routineFinishOperation(createReqVO);
+ return result;
+ } catch ( RuntimeException runtimeException ) {
+ String err = ExceptionUtils.formatException( runtimeException );
+ log.error("checkFinish: " + err);
+ return CommonResult.error(DEV_INSTALL_EXCEPTION);
+ }
+ }
+
@PostMapping("/dev-ready")
@Operation(summary = "璁惧棰嗙敤")
@PreAuthorize("@ss.hasPermission('ecg:doctor:task')")
@@ -106,7 +121,7 @@
}
@PostMapping("/dev-ready-cancel")
- @Operation(summary = "鍙栨秷瑁呮満")
+ @Operation(summary = "鍙栨秷棰嗙敤")
@PreAuthorize("@ss.hasPermission('ecg:doctor:task')")
public CommonResult<Long> devReadyCancel(@Valid @RequestBody DevCancelReqVO cancelReqVO) {
try {
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 9cafa3f..b2c49b7 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
@@ -28,6 +28,14 @@
* @param createReqVO 鍒涘缓淇℃伅
* @return 缂栧彿
*/
+ CommonResult<Long> routineFinishOperation(@Valid DevRentSaveReqVO createReqVO);
+
+ /**
+ * 璁惧鍑嗗
+ *
+ * @param createReqVO 鍒涘缓淇℃伅
+ * @return 缂栧彿
+ */
CommonResult<Long> readyOperation(@Valid DevRentSaveReqVO 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 139f048..c0fcb55 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
@@ -60,6 +60,68 @@
}
@Override
+ public CommonResult<Long> routineFinishOperation(DevRentSaveReqVO createReqVO) {
+ Long userId = SecurityFrameworkUtils.getLoginUserId();
+ String userNickname = SecurityFrameworkUtils.getLoginUserNickname();
+
+ // 鍚屾牱 鍦ㄩ绾︾‘瀹炴椂 灏辫繘鍏� [dev_rent] 琛ㄤ簡
+ Long rent_id = createReqVO.getId();
+ if (null == rent_id) {
+ List<DevRentDO> devRentDOList = devRentMapper.selectByPatIdAndState(createReqVO.getPatId(), DevRentStateEnum.FREE.getState());
+ if (devRentDOList.size() == 0)
+ return CommonResult.error(DEV_INSTALL_NOT_APPOINTMENT);
+ else if (devRentDOList.size() != 1) {
+ return CommonResult.error(DEV_INSTALL_EXCEPTION);
+ }
+
+ rent_id = devRentDOList.getFirst().getId();
+ createReqVO.setId( rent_id );
+ createReqVO.setState( DevRentStateEnum.ROUTINE_FINISH.getState() );
+ updateDevRent( 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( DevRentStateEnum.ROUTINE_FINISH.getState() );
+ jobRecordSaveReqVO.setRemark(createReqVO.getRemark());
+ jobRecordSaveReqVO.setSummary("");
+
+ JobRecordDO jobRecord = BeanUtils.toBean(jobRecordSaveReqVO, JobRecordDO.class);
+ jobRecordMapper.insert(jobRecord);
+ } else {
+ // 鎾ら攢 鏀惧純鎿嶄綔
+ createReqVO.setState( DevRentStateEnum.ROUTINE_FINISH.getState() );
+
+ updateDevRent( createReqVO );
+
+ List<Integer> jobTypeList = new ArrayList<Integer>();
+ jobTypeList.add( DevRentStateEnum.ROUTINE_FINISH.getState());
+ jobTypeList.add( DevRentStateEnum.READY_CANCELLED.getState());
+ JobRecordDO jobRecordDO = jobRecordMapper.selectByRentIdDocId(rent_id, userId, jobTypeList);
+ if (null != jobRecordDO) {
+ jobRecordDO.setDevId(createReqVO.getDevId());
+ jobRecordDO.setJobType( DevRentStateEnum.ROUTINE_FINISH.getState() );
+ jobRecordDO.setJobTime(createReqVO.getRentTime());
+ jobRecordDO.setRemark(createReqVO.getRemark());
+ jobRecordDO.setUpdater(String.valueOf(userId));
+ jobRecordDO.setUpdateTime(LocalDateTime.now());
+ jobRecordMapper.updateById(jobRecordDO);
+ }
+ }
+
+ // 鏇存柊..闃熷垪鐘舵��
+ queueMapper.updateBedQueueStatus(createReqVO.getRoomId(), createReqVO.getBedNo(),
+ QueueStatusEnum.ONSTAGE.getStatus(), QueueStatusEnum.FINISH.getStatus());
+
+ return CommonResult.success(rent_id);
+ }
+
+ @Override
@Transactional
public CommonResult<Long> readyOperation(DevRentSaveReqVO createReqVO) {
Long userId = SecurityFrameworkUtils.getLoginUserId();
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 da4e17e..f7fa9bc 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
@@ -332,8 +332,15 @@
@Override
public void finishNextPatient(Long roomId, String bedNo) {
// 浠� DB 鎶� 灏辫瘖涓殑浜� 璁剧疆涓哄氨璇婂畬鎴�
- Integer ret = queueMapper.updateBedQueueStatus(roomId, bedNo,
- QueueStatusEnum.ONSTAGE.getStatus(), QueueStatusEnum.FINISH.getStatus());
+ //Integer ret = queueMapper.updateBedQueueStatus(roomId, bedNo,
+ // QueueStatusEnum.ONSTAGE.getStatus(), QueueStatusEnum.FINISH.getStatus());
+
+ // 浠� DB 妫�鏌� 璇ュ伐浣� 鏄惁鏈� [灏辫瘖涓璢 浜哄憳锛岃嫢鏈夊氨.鏀惧純鍙栦笅涓�浣�
+ List<Byte> queueStatusList = new ArrayList<>();
+ queueStatusList.add(QueueStatusEnum.ONSTAGE.getStatus());
+ Integer num = queueMapper.bedQueueStatisticByStatus(roomId, bedNo, queueStatusList);
+ if ( num != null && num > 0)
+ return;
startNextPatient(roomId, bedNo);
}
@@ -345,7 +352,7 @@
//Integer ret = queueMapper.updateBedQueueStatus(roomId, bedNo,
// QueueStatusEnum.ONSTAGE.getStatus(), QueueStatusEnum.RECEIVED.getStatus());
- // 浠� DB 妫�鏌� 璇ュ伐浣� 鏄惁鏈� [灏辫瘖涓璢 浜哄憳锛岃嫢鏈夊氨.鏀惧純.鍙栦笅涓�浣�
+ // 浠� DB 妫�鏌� 璇ュ伐浣� 鏄惁鏈� [灏辫瘖涓璢 浜哄憳锛岃嫢鏈夊氨.鏀惧純鍙栦笅涓�浣�
List<Byte> queueStatusList = new ArrayList<>();
queueStatusList.add(QueueStatusEnum.ONSTAGE.getStatus());
Integer num = queueMapper.bedQueueStatisticByStatus(roomId, bedNo, queueStatusList);
@@ -362,7 +369,7 @@
//Integer ret = queueMapper.updateBedQueueStatus(roomId, bedNo,
// QueueStatusEnum.INSTALLING.getStatus(), QueueStatusEnum.FINISH.getStatus());
- // 浠� DB 妫�鏌� 璇ュ伐浣� 鏄惁鏈� [灏辫瘖涓璢 浜哄憳锛岃嫢鏈夊氨.鏀惧純.鍙栦笅涓�浣�
+ // 浠� DB 妫�鏌� 璇ュ伐浣� 鏄惁鏈� [灏辫瘖涓璢 浜哄憳锛岃嫢鏈夊氨.鏀惧純鍙栦笅涓�浣�
List<Byte> queueStatusList = new ArrayList<>();
queueStatusList.add(QueueStatusEnum.INSTALLING.getStatus());
Integer num = queueMapper.bedQueueStatisticByStatus(roomId, bedNo, queueStatusList);
--
Gitblit v1.9.3