From 4feb978ac9908a46e7285ab0c9a897b89fd99ff2 Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期一, 25 十一月 2024 20:17:57 +0800
Subject: [PATCH] Fix Bug:  当天多个检查项目  打印小票 检查项目不对

---
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/AppointmentController.java |    5 +++--
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentService.java             |    4 ++--
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/appointment/AppointmentMapper.java            |    2 ++
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImpl.java         |    7 +++----
 4 files changed, 10 insertions(+), 8 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 f3c7002..4b8f4a7 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
@@ -95,8 +95,9 @@
     @Operation(summary = "鏍规嵁鎮h�呯紪鍙�.鏌ヨ褰撳ぉ棰勭害")
     @Parameter(name = "id", description = "缂栧彿", required = true, example = "1024")
     @PreAuthorize("@ss.hasPermission('ecg:appointment:query')")
-    public CommonResult<AppointmentRespVO> getCurAppointmentByPatId(@RequestParam("patId") String patId) {
-        AppointmentDO appointment = appointmentService.getCurAppointmentByPatId( patId );
+    public CommonResult<AppointmentRespVO> getCurAppointmentByPatId(@RequestParam("patId") String patId,
+                                                                    @RequestParam("checkType") Integer checkType) {
+        AppointmentDO appointment = appointmentService.getCurAppointmentByPatIdAndCheckType( patId, checkType );
         return success(BeanUtils.toBean(appointment, AppointmentRespVO.class));
     }
 
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 c9407f6..5ff8284 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
@@ -45,8 +45,10 @@
                 .orderByDesc(AppointmentDO::getId));
     }
 
+/*
     @Select("select * from lihu.appointment where pat_id = #{patId} and to_days(book_date) = to_days(Now())")
     List<AppointmentDO> getCurrentPatId(@Param("patId") String patId);
+*/
 
     @Select("select * from lihu.appointment where pat_id = #{patId} and book_check_type = #{checkType} and to_days(book_date) = to_days(Now()) limit 1")
     AppointmentDO getCurrentByPatAndCheckType(@Param("patId") String patId, @Param("checkType") Integer checkType);
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 1823a35..3543317 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,12 +45,12 @@
     AppointmentDO getAppointment(Long id);
 
     /**
-     * 鑾峰緱褰撳ぉ鐨勯绾� 鏍规嵁PatID
+     * 鑾峰緱褰撳ぉ鐨勯绾� 鏍规嵁PatID and CheckType
      *
      * @param patId 缂栧彿
      * @return 棰勭害
      */
-    AppointmentDO getCurAppointmentByPatId(String patId);
+    AppointmentDO getCurAppointmentByPatIdAndCheckType(String patId, Integer checkType);
 
     /**
      * 鑾峰緱棰勭害
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 e433dcd..16fe636 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
@@ -112,11 +112,10 @@
         return appointmentMapper.selectById(id);
     }
 
-    // TODO 灏氫笉鏀寔, 涓�浣嶆偅鑰呭綋澶╀袱绉嶆鏌ラ」鐩殑鎯呭喌
     @Override
-    public AppointmentDO getCurAppointmentByPatId(String patId) {
-        List<AppointmentDO> appointmentDOList = appointmentMapper.getCurrentPatId( patId );
-        return 0 == appointmentDOList.size() ? null : appointmentDOList.get(0);
+    public AppointmentDO getCurAppointmentByPatIdAndCheckType(String patId, Integer checkType) {
+        AppointmentDO appointmentDO = appointmentMapper.getByPatAndCheckTypeAndBookDate( patId, checkType, LocalDate.now() );
+        return appointmentDO;
     }
 
     /**

--
Gitblit v1.9.3