From 24b7c98e01c211e93f00293e6e4e96ba1b9db93f Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期一, 14 十月 2024 14:50:43 +0800
Subject: [PATCH] 常规检查 step 2

---
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentService.java                     |    2 
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/AppointmentController.java |    9 ++++
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/RoutineFinishReqVO.java     |   60 ++++++++++++++++++++++++++++++
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentService.java             |    8 ++++
 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/service/devrent/DevRentServiceImpl.java                 |    4 +
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/appointment/AppointmentMapper.java            |    8 ++++
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImpl.java         |    5 ++
 8 files changed, 97 insertions(+), 5 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 a7172eb..0347684 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
@@ -109,6 +109,15 @@
         return success(BeanUtils.toBean(appointment, AppointmentRespVO.class));
     }
 
+    @GetMapping("/get-by-patient")
+    @Operation(summary = "鑾峰緱棰勭害")
+    @Parameter(name = "id", description = "缂栧彿", required = true, example = "1024")
+    @PreAuthorize("@ss.hasPermission('ecg:appointment:query')")
+    public CommonResult<AppointmentRespVO> getAppointmentByPatient(@RequestParam("patId") String patId) {
+        AppointmentDO appointment = appointmentService.getAppointmentByPatId( patId );
+        return success(BeanUtils.toBean(appointment, AppointmentRespVO.class));
+    }
+
     @GetMapping("/page")
     @Operation(summary = "鑾峰緱棰勭害鍒嗛〉")
     @PreAuthorize("@ss.hasPermission('ecg:appointment:query')")
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 abe1c41..6d32f25 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
@@ -54,13 +54,13 @@
     @PostMapping("/routine-finish")
     @Operation(summary = "")
     @PreAuthorize("@ss.hasPermission('ecg:doctor:task')")
-    public CommonResult<Long> routineFinish(@Valid @RequestBody DevRentSaveReqVO createReqVO) {
+    public CommonResult<Long> routineFinish(@Valid @RequestBody RoutineFinishReqVO routineFinishReqVO) {
         try {
-            CommonResult<Long> result = devRentService.routineFinishOperation(createReqVO);
+            CommonResult<Long> result = devRentService.routineFinishOperation(routineFinishReqVO);
             return result;
         } catch ( RuntimeException runtimeException ) {
             String err = ExceptionUtils.formatException( runtimeException );
-            log.error("checkFinish: " + err);
+            log.error("routineFinish: " + err);
             return CommonResult.error(DEV_INSTALL_EXCEPTION);
         }
     }
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/RoutineFinishReqVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/RoutineFinishReqVO.java
new file mode 100644
index 0000000..9460e5f
--- /dev/null
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/RoutineFinishReqVO.java
@@ -0,0 +1,60 @@
+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 RoutineFinishReqVO {
+
+    @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "26525")
+    private Long id;
+
+    @Schema(description = "璁惧缂栧彿", requiredMode = Schema.RequiredMode.REQUIRED, example = "3986")
+    //@NotEmpty(message = "璁惧缂栧彿涓嶈兘涓虹┖")
+    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 LocalDateTime entryTime;
+
+    @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 state;
+
+    @Schema(description = "宸蹭粯娆�")
+    private Integer paid;
+
+    @Schema(description = "璇婂缂栧彿")
+    Long roomId;
+
+    @Schema(description = "璇婂簥缂栧彿")
+    String bedNo;
+}
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/appointment/AppointmentMapper.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/appointment/AppointmentMapper.java
index 23f6de5..7727223 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/appointment/AppointmentMapper.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/appointment/AppointmentMapper.java
@@ -6,8 +6,11 @@
 import cn.lihu.jh.framework.mybatis.core.query.LambdaQueryWrapperX;
 import cn.lihu.jh.framework.mybatis.core.mapper.BaseMapperX;
 import cn.lihu.jh.module.ecg.dal.dataobject.appointment.AppointmentDO;
+import cn.lihu.jh.module.ecg.dal.dataobject.room.RoomDO;
 import org.apache.ibatis.annotations.Mapper;
 import cn.lihu.jh.module.ecg.controller.admin.appointment.vo.*;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
 
 /**
  * 棰勭害 Mapper
@@ -41,4 +44,9 @@
                 .orderByDesc(AppointmentDO::getId));
     }
 
+
+    @Select("select * from lihu.appointment where pat_id = #{patId} and to_days(book_date) = to_days(Now()) limit 1")
+    AppointmentDO getByPatId(@Param("patId") String patId);
+
+
 }
\ 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/appointment/AppointmentService.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentService.java
index 014ccf2..bc245a7 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentService.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentService.java
@@ -45,6 +45,14 @@
     AppointmentDO getAppointment(Integer id);
 
     /**
+     * 鑾峰緱棰勭害
+     *
+     * @param id 缂栧彿
+     * @return 棰勭害
+     */
+    AppointmentDO getAppointmentByPatId(String patId);
+
+    /**
      * 鑾峰緱棰勭害鍒嗛〉
      *
      * @param pageReqVO 鍒嗛〉鏌ヨ
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImpl.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImpl.java
index a29b562..c165a8a 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImpl.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImpl.java
@@ -73,6 +73,11 @@
     }
 
     @Override
+    public AppointmentDO getAppointmentByPatId(String patId) {
+        return appointmentMapper.getByPatId( patId );
+    }
+
+    @Override
     public PageResult<AppointmentDO> getAppointmentPage(AppointmentPageReqVO pageReqVO) {
         return appointmentMapper.selectPage(pageReqVO);
     }
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 b2c49b7..ecc8a64 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,7 +28,7 @@
      * @param createReqVO 鍒涘缓淇℃伅
      * @return 缂栧彿
      */
-    CommonResult<Long> routineFinishOperation(@Valid DevRentSaveReqVO createReqVO);
+    CommonResult<Long> routineFinishOperation(@Valid RoutineFinishReqVO 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 c0fcb55..a933ea8 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,7 +60,9 @@
     }
 
     @Override
-    public CommonResult<Long> routineFinishOperation(DevRentSaveReqVO createReqVO) {
+    public CommonResult<Long> routineFinishOperation(RoutineFinishReqVO routineFinishReqVO) {
+        DevRentSaveReqVO createReqVO = BeanUtils.toBean(routineFinishReqVO, DevRentSaveReqVO.class);
+
         Long userId = SecurityFrameworkUtils.getLoginUserId();
         String userNickname = SecurityFrameworkUtils.getLoginUserNickname();
 

--
Gitblit v1.9.3