From be29e4df82e7f6425db15b03f09aaee1cd9cfb1d Mon Sep 17 00:00:00 2001 From: eight <641137800@qq.com> Date: 星期二, 15 十月 2024 16:32:39 +0800 Subject: [PATCH] 大屏.小屏 叫号逻辑 --- jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/doctor/DoctorController.java | 203 ++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 177 insertions(+), 26 deletions(-) diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/doctor/DoctorController.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/doctor/DoctorController.java index 435ab45..b214488 100644 --- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/doctor/DoctorController.java +++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/doctor/DoctorController.java @@ -126,7 +126,7 @@ } @GetMapping("/finish-next-patient") - @Operation(summary = "瀹屾垚銆佷笅涓�浣嶆偅鑰�") + @Operation(summary = "甯歌鍙彿銆佷笅涓�浣嶆偅鑰�") @Parameter(name = "roomId", description = "璇婂缂栧彿", required = true, example = "116") @Parameter(name = "bedNo", description = "宸ヤ綅缂栧彿", required = true, example = "B2") @PreAuthorize("@ss.hasPermission('ecg:doctor:task')") @@ -136,12 +136,7 @@ { queueService.finishNextPatient(roomId, bedNo); - List<Byte> queueStatusList = new ArrayList<>(); - queueStatusList.add(QueueStatusEnum.RECALLED.getStatus()); - queueStatusList.add(QueueStatusEnum.READY.getStatus()); - queueStatusList.add(QueueStatusEnum.ONSTAGE.getStatus()); - queueStatusList.add(QueueStatusEnum.PASSED.getStatus()); - List<QueueDO> queueDOList = queueService.getDoctorQueueByStatus(roomId, bedNo, queueStatusList); + List<QueueDO> queueDOList = queueService.getToBeCheckedPatient(roomId, bedNo); // 杩囨护鍑� 灏辫瘖涓殑锛屽噯澶囧彨鍙� QueueDO onStageItem = queueDOList.stream().filter(item -> Objects.equals(item.getStatus(), QueueStatusEnum.ONSTAGE.getStatus())).findFirst().orElse(null); @@ -154,6 +149,57 @@ return success(BeanUtils.toBean(queueDOList, QueueRespVO.class)); } + @GetMapping("/finish-receive-next-patient") + @Operation(summary = "棰嗙敤鍙彿銆佷笅涓�浣嶆偅鑰�") + @Parameter(name = "roomId", description = "璇婂缂栧彿", required = true, example = "116") + @Parameter(name = "bedNo", description = "宸ヤ綅缂栧彿", required = true, example = "B2") + @PreAuthorize("@ss.hasPermission('ecg:doctor:task')") + public CommonResult<List<QueueRespVO>> finishReceiveNextPatient( + @RequestParam("roomId") Long roomId, + @RequestParam("bedNo") String bedNo) + { + queueService.finishReceiveNextPatient(roomId, bedNo); + + List<QueueDO> queueDOList = queueService.getToBeCheckedPatient(roomId, bedNo); + + // 杩囨护鍑� 灏辫瘖涓殑锛屽噯澶囧彨鍙� + QueueDO onStageItem = queueDOList.stream().filter(item -> Objects.equals(item.getStatus(), QueueStatusEnum.ONSTAGE.getStatus())).findFirst().orElse(null); + if (null != onStageItem) { + CallSaveReqVO callSaveReqVO = BeanUtils.toBean(onStageItem, CallSaveReqVO.class); + callSaveReqVO.setId(null); + callService.createCall(callSaveReqVO); + } + + return success(BeanUtils.toBean(queueDOList, QueueRespVO.class)); + } + + @GetMapping("/finish-install-next-patient") + @Operation(summary = "瑁呮満鍙彿銆佷笅涓�浣嶆偅鑰�") + @Parameter(name = "roomId", description = "璇婂缂栧彿", required = true, example = "116") + @Parameter(name = "bedNo", description = "宸ヤ綅缂栧彿", required = true, example = "B2") + @PreAuthorize("@ss.hasPermission('ecg:doctor:task')") + public CommonResult<List<QueueRespVO>> finishInstallNextPatient( + @RequestParam("roomId") Long roomId, + @RequestParam("bedNo") String bedNo) + { + queueService.finishInstallNextPatient(roomId, bedNo); + + List<QueueDO> queueDOList = queueService.getToBeInstalledPatient(roomId, bedNo); + + List<QueueDO> installingQueueDOList = queueDOList.stream().filter(queueDO -> queueDO.getStatus() == QueueStatusEnum.INSTALLING.getStatus()).toList(); + // 杩囨护鍑� [瀹夎涓璢 鐨勶紝鍑嗗鍙彿 璇ュ伐浣嶅簲璇� 鏈�澶氬彧鏈変竴涓� [瀹夎涓璢 + if (installingQueueDOList.size() > 0) { + QueueDO onStageItem = installingQueueDOList.getFirst(); + CallSaveReqVO callSaveReqVO = BeanUtils.toBean(onStageItem, CallSaveReqVO.class); + callSaveReqVO.setId(null); + callSaveReqVO.setCallType(1); // 瑁呮満鍙彿 + callService.createCall(callSaveReqVO); + } + + return success(BeanUtils.toBean(queueDOList, QueueRespVO.class)); + } + + // 甯歌妫�鏌ヨ繃鍙枫�侀鐢ㄨ繃鍙� @GetMapping("/pass-next-patient") @Operation(summary = "杩囧彿銆佷笅涓�浣嶆偅鑰�") @Parameter(name = "roomId", description = "璇婂缂栧彿", required = true, example = "116") @@ -165,12 +211,7 @@ { queueService.passNextPatient(roomId, bedNo); - List<Byte> queueStatusList = new ArrayList<>(); - queueStatusList.add(QueueStatusEnum.RECALLED.getStatus()); - queueStatusList.add(QueueStatusEnum.READY.getStatus()); - queueStatusList.add(QueueStatusEnum.ONSTAGE.getStatus()); - queueStatusList.add(QueueStatusEnum.PASSED.getStatus()); - List<QueueDO> queueDOList = queueService.getDoctorQueueByStatus(roomId, bedNo, queueStatusList); + List<QueueDO> queueDOList = queueService.getToBeCheckedPatient(roomId, bedNo); // 杩囨护鍑� 灏辫瘖涓殑锛屽噯澶囧彨鍙� QueueDO onStageItem = queueDOList.stream().filter(item -> Objects.equals(item.getStatus(), QueueStatusEnum.ONSTAGE.getStatus())).findFirst().orElse(null); @@ -183,18 +224,44 @@ return success(BeanUtils.toBean(queueDOList, QueueRespVO.class)); } - @GetMapping("/call-again") - @Operation(summary = "閲嶅彨銆佹偅鑰�") + @GetMapping("/pass-install-next-patient") + @Operation(summary = "瀹夎杩囧彿銆佷笅涓�浣嶆偅鑰�") @Parameter(name = "roomId", description = "璇婂缂栧彿", required = true, example = "116") @Parameter(name = "bedNo", description = "宸ヤ綅缂栧彿", required = true, example = "B2") @PreAuthorize("@ss.hasPermission('ecg:doctor:task')") - public CommonResult<String> callAgainPatient( + public CommonResult<List<QueueRespVO>> passInstallNextPatient( + @RequestParam("roomId") Long roomId, + @RequestParam("bedNo") String bedNo) + { + queueService.passInstallNextPatient(roomId, bedNo); + + List<QueueDO> queueDOList = queueService.getToBeInstalledPatient(roomId, bedNo); + + List<QueueDO> installingQueueDOList = queueDOList.stream().filter(queueDO -> queueDO.getStatus() == QueueStatusEnum.INSTALLING.getStatus()).toList(); + // 杩囨护鍑� [瀹夎涓璢 鐨勶紝鍑嗗鍙彿 璇ュ伐浣嶅簲璇� 鏈�澶氬彧鏈変竴涓� [瀹夎涓璢 + if (installingQueueDOList.size() > 0) { + QueueDO onStageItem = installingQueueDOList.getFirst(); + CallSaveReqVO callSaveReqVO = BeanUtils.toBean(onStageItem, CallSaveReqVO.class); + callSaveReqVO.setId(null); + callSaveReqVO.setCallType(1); // 瑁呮満鍙彿 + callService.createCall(callSaveReqVO); + } + + return success(BeanUtils.toBean(queueDOList, QueueRespVO.class)); + } + + @GetMapping("/call-again") + @Operation(summary = "[甯歌妫�鏌鎴朳棰嗙敤] 閲嶅彨銆佹偅鑰�") + @Parameter(name = "roomId", description = "璇婂缂栧彿", required = true, example = "116") + @Parameter(name = "bedNo", description = "宸ヤ綅缂栧彿", required = true, example = "B2") + @PreAuthorize("@ss.hasPermission('ecg:doctor:task')") + public CommonResult<String> callPatientAgain( @RequestParam("roomId") Long roomId, @RequestParam("bedNo") String bedNo) { List<Byte> queueStatusList = new ArrayList<>(); queueStatusList.add(QueueStatusEnum.ONSTAGE.getStatus()); - List<QueueDO> queueDOList = queueService.getDoctorQueueByStatus(roomId, bedNo, queueStatusList); + List<QueueDO> queueDOList = queueService.getBedQueueByStatus(roomId, bedNo, queueStatusList); if (queueDOList.isEmpty()) return success("鏃犲氨璇婁腑鎮h��"); @@ -212,21 +279,60 @@ return success("鎿嶄綔鎴愬姛"); } - @GetMapping("/get-patient-list") - @Operation(summary = "鍙栨偅鑰呭垪琛�") + + @GetMapping("/call-install-again") + @Operation(summary = "閲嶅彨銆佹偅鑰�") @Parameter(name = "roomId", description = "璇婂缂栧彿", required = true, example = "116") @Parameter(name = "bedNo", description = "宸ヤ綅缂栧彿", required = true, example = "B2") @PreAuthorize("@ss.hasPermission('ecg:doctor:task')") - public CommonResult<List<QueueRespVO>> getPatientList( + public CommonResult<String> callInstallingPatientAgain( @RequestParam("roomId") Long roomId, @RequestParam("bedNo") String bedNo) { List<Byte> queueStatusList = new ArrayList<>(); - queueStatusList.add(QueueStatusEnum.RECALLED.getStatus()); - queueStatusList.add(QueueStatusEnum.READY.getStatus()); - queueStatusList.add(QueueStatusEnum.ONSTAGE.getStatus()); - queueStatusList.add(QueueStatusEnum.PASSED.getStatus()); - List<QueueDO> queueDOList = queueService.getDoctorQueueByStatus(roomId, bedNo, queueStatusList); + queueStatusList.add(QueueStatusEnum.INSTALLING.getStatus()); + List<QueueDO> queueDOList = queueService.getBedQueueByStatus(roomId, bedNo, queueStatusList); + + if (queueDOList.isEmpty()) + return success("鏃犲畨瑁呬腑鐨勬偅鑰�"); + + if (queueDOList.size() > 1) { + log.error("room {} bed {} have {} 瀹夎涓殑鎮h��", roomId, bedNo, queueDOList.size()); + return error(ECG_INNER_ERROR); + } + + QueueDO onStageItem = queueDOList.get(0); + CallSaveReqVO callSaveReqVO = BeanUtils.toBean(onStageItem, CallSaveReqVO.class); + callSaveReqVO.setId(null); + callSaveReqVO.setCallType(1); // 瑁呮満鍙彿 + callService.callAgain(callSaveReqVO); + + return success("鎿嶄綔鎴愬姛"); + } + + @GetMapping("/get-to-be-checked-list") + @Operation(summary = "鍙� [甯歌妫�鏌 鎴� [寰呴鐢╙ 鎮h�呭垪琛�") + @Parameter(name = "roomId", description = "璇婂缂栧彿", required = true, example = "116") + @Parameter(name = "bedNo", description = "宸ヤ綅缂栧彿", required = true, example = "B2") + @PreAuthorize("@ss.hasPermission('ecg:doctor:task')") + public CommonResult<List<QueueRespVO>> getToBeCheckedPatientList( + @RequestParam("roomId") Long roomId, + @RequestParam("bedNo") String bedNo) + { + List<QueueDO> queueDOList = queueService.getToBeCheckedPatient(roomId, bedNo); + return success(BeanUtils.toBean(queueDOList, QueueRespVO.class)); + } + + @GetMapping("/get-to-be-installed-list") + @Operation(summary = "鍙� [寰呭畨瑁匽 鎮h�呭垪琛�") + @Parameter(name = "roomId", description = "璇婂缂栧彿", required = true, example = "116") + @Parameter(name = "bedNo", description = "宸ヤ綅缂栧彿", required = true, example = "B2") + @PreAuthorize("@ss.hasPermission('ecg:doctor:task')") + public CommonResult<List<QueueRespVO>> getToBeInstalledPatientList( + @RequestParam("roomId") Long roomId, + @RequestParam("bedNo") String bedNo) + { + List<QueueDO> queueDOList = queueService.getToBeInstalledPatient(roomId, bedNo); return success(BeanUtils.toBean(queueDOList, QueueRespVO.class)); } @@ -240,6 +346,33 @@ @RequestParam("bedNo") String bedNo) { PatientStatisticVO patientStatisticVO = queueService.getPatientStatistic(roomId, bedNo); + return success(patientStatisticVO); + } + + @GetMapping("/get-dev-ready-statistic") + @Operation(summary = "璁惧棰嗙敤缁熻") + @Parameter(name = "roomId", description = "璇婂缂栧彿", required = true, example = "116") + @Parameter(name = "bedNo", description = "宸ヤ綅缂栧彿", required = true, example = "B2") + @PreAuthorize("@ss.hasPermission('ecg:doctor:task')") + public CommonResult<PatientStatisticVO> getDevReadyStatistic( + @RequestParam("roomId") Long roomId, + @RequestParam("bedNo") String bedNo) + { + PatientStatisticVO patientStatisticVO = queueService.getBedDevReadyStatistic(roomId, bedNo); + return success(patientStatisticVO); + } + + + @GetMapping("/get-dev-install-statistic") + @Operation(summary = "璁惧瑁呮満缁熻") + @Parameter(name = "roomId", description = "璇婂缂栧彿", required = true, example = "116") + @Parameter(name = "bedNo", description = "宸ヤ綅缂栧彿", required = true, example = "B2") + @PreAuthorize("@ss.hasPermission('ecg:doctor:task')") + public CommonResult<PatientStatisticVO> getDevInstallStatistic( + @RequestParam("roomId") Long roomId, + @RequestParam("bedNo") String bedNo) + { + PatientStatisticVO patientStatisticVO = queueService.getBedDevInstallStatistic(roomId, bedNo); return success(patientStatisticVO); } @@ -258,7 +391,25 @@ if (null == result || 0 == result) return error(PATIENT_NOT_EXISTS); - return success("success"); + return success("鎿嶄綔鎴愬姛"); + } + + @GetMapping("/recall-install-patient") + @Operation(summary = "杩囧彿瀹夎鐥呬汉鍙洖") + @Parameter(name = "roomId", description = "璇婂缂栧彿", required = true, example = "116") + @Parameter(name = "bedNo", description = "宸ヤ綅缂栧彿", required = true, example = "B2") + @Parameter(name = "patId", description = "鎮h�呯紪鍙�", required = true, example = "B2") + @PreAuthorize("@ss.hasPermission('ecg:doctor:task')") + public CommonResult<String> recallInstallPatient( + @RequestParam("roomId") Long roomId, + @RequestParam("bedNo") String bedNo, + @RequestParam("patId") String patId ) + { + Integer result = queueService.recallInstallPatient(roomId, bedNo, patId); + if (null == result || 0 == result) + return error(PATIENT_NOT_EXISTS); + + return success("鎿嶄綔鎴愬姛"); } } -- Gitblit v1.9.3