G vor 1 Woche
Ursprung
Commit
96fdeb6f93

+ 1 - 0
tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/dto/PatientTherapyDetailDTO.java

@@ -1,5 +1,6 @@
 package cn.tr.module.phototherapy.common.dto;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 import java.time.LocalDateTime;

+ 4 - 3
tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/dto/TherapyRecordDetailQueryDTO.java

@@ -1,10 +1,11 @@
 package cn.tr.module.phototherapy.common.dto;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.v3.oas.annotations.media.Schema;
 import jakarta.validation.constraints.NotBlank;
 import lombok.Data;
 
-import java.time.LocalDate;
+import java.util.Date;
 
 /**
  * @ClassName TherapyRecordDetailQueryDTO
@@ -21,10 +22,10 @@ public class TherapyRecordDetailQueryDTO {
     private String clinicId;
 
     @Schema(description = "开始日期")
-    private LocalDate startDate;
+    private Date startDate;
 
     @Schema(description = "结束日期")
-    private LocalDate endDate;
+    private Date endDate;
 
     @Schema(description = "时间范围类型:0-自定义,1-今日数据,2-最近一周,3-最近两周,4-最近三周,5-最近一月,6-最近半年")
     private Integer timeRangeType = 0;  // 默认为自定义

+ 9 - 8
tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/handle/TimeRangeHandler.java

@@ -1,6 +1,7 @@
 package cn.tr.module.phototherapy.common.handle;
 
 import java.time.LocalDate;
+import java.util.Date;
 
 /**
  * 时间范围处理器
@@ -15,32 +16,32 @@ public class TimeRangeHandler {
      * @param timeRangeType 时间范围类型(1-今日,2-近一周...)
      * @return 处理后的[startDate, endDate]数组
      */
-    public static LocalDate[] handleTimeRange(LocalDate startDate, LocalDate endDate, Integer timeRangeType) {
+    public static Date[] handleTimeRange(Date startDate, Date endDate, Integer timeRangeType) {
         if (timeRangeType != null && timeRangeType > 0) {
-            LocalDate now = LocalDate.now();
+            Date now = new Date();
             switch (timeRangeType) {
                 case 1: // 今日数据
                     startDate = now;
                     endDate = now;
                     break;
                 case 2: // 最近一周
-                    startDate = now.minusWeeks(1);
+                    startDate = new Date(now.getTime() - 7 * 24 * 60 * 60 * 1000);
                     endDate = now;
                     break;
                 case 3: // 最近两周
-                    startDate = now.minusWeeks(2);
+                    startDate = new Date(now.getTime() - 14 * 24 * 60 * 60 * 1000);
                     endDate = now;
                     break;
                 case 4: // 最近三周
-                    startDate = now.minusWeeks(3);
+                    startDate = new Date(now.getTime() - 21 * 24 * 60 * 60 * 1000);
                     endDate = now;
                     break;
                 case 5: // 最近一月
-                    startDate = now.minusMonths(1);
+                    startDate = new Date(now.getTime() - 30 * 24 * 60 * 60 * 1000);
                     endDate = now;
                     break;
                 case 6: // 最近半年
-                    startDate = now.minusMonths(6);
+                    startDate = new Date(now.getTime() - 180 * 24 * 60 * 60 * 1000);
                     endDate = now;
                     break;
                 default:
@@ -48,6 +49,6 @@ public class TimeRangeHandler {
                     break;
             }
         }
-        return new LocalDate[]{startDate, endDate};
+        return new Date[]{startDate, endDate};
     }
 }

+ 3 - 2
tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/repository/BusTherapyRecordRepository.java

@@ -9,6 +9,7 @@ import org.springframework.stereotype.Repository;
 
 import java.time.LocalDate;
 import java.time.LocalDateTime;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -31,6 +32,6 @@ public interface BusTherapyRecordRepository extends BaseMapper<BusTherapyRecordP
      */
     List<TherapyRecordDetailVO> selectTherapyRecordWithPlan(
             @Param("clinicId") String clinicId,
-            @Param("startDateTime") LocalDateTime startDateTime,
-            @Param("endDateTime") LocalDateTime endDateTime);
+            @Param("startDateTime") Date startDateTime,
+            @Param("endDateTime") Date endDateTime);
 }

+ 1 - 1
tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/service/IBusTherapyRecordService.java

@@ -62,6 +62,6 @@ public interface IBusTherapyRecordService{
      * @param clinicId 临床ID
      * @return 治疗记录列表
      */
-    List<TherapyRecordDetailDTO> getPatientTherapyRecordList(String clinicId, LocalDate startDate, LocalDate endDate, Integer timeRangeType);
+    List<TherapyRecordDetailDTO> getPatientTherapyRecordList(String clinicId, Date startDate, Date endDate, Integer timeRangeType);
 
 }

+ 4 - 4
tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/service/impl/BusTherapyRecordServiceImpl.java

@@ -120,15 +120,15 @@ public class BusTherapyRecordServiceImpl extends ServiceImpl<BusTherapyRecordRep
      * @return 治疗记录列表
      */
     @Override
-    public List<TherapyRecordDetailDTO> getPatientTherapyRecordList(String clinicId, LocalDate startDate, LocalDate endDate, Integer timeRangeType) {
+    public List<TherapyRecordDetailDTO> getPatientTherapyRecordList(String clinicId, Date startDate, Date endDate, Integer timeRangeType) {
         // 处理预设时间范围
-        LocalDate[] dateRange = TimeRangeHandler.handleTimeRange(startDate, endDate, timeRangeType);
+        Date[] dateRange = TimeRangeHandler.handleTimeRange(startDate, endDate, timeRangeType);
         startDate = dateRange[0];
         endDate = dateRange[1];
 
         // 执行多表联查
-        LocalDateTime startDateTime = QueryParamUtil.convertToStartOfDay(startDate);
-        LocalDateTime endDateTime = QueryParamUtil.convertToEndOfDay(endDate);
+        Date startDateTime = QueryParamUtil.convertToStartOfDayFromDate(startDate);
+        Date endDateTime = QueryParamUtil.convertToEndOfDayFromDate(endDate);
 
         List<TherapyRecordDetailVO> results = therapyRecordRepository.selectTherapyRecordWithPlan(clinicId, startDateTime, endDateTime);
 

+ 36 - 0
tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/utils/QueryParamUtil.java

@@ -3,6 +3,8 @@ package cn.tr.module.phototherapy.common.utils;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.LocalTime;
+import java.util.Calendar;
+import java.util.Date;
 
 /**
  * 通用查询参数工具类
@@ -33,4 +35,38 @@ public class QueryParamUtil {
         // LocalTime.MAX会自动适配为23:59:59.999999999,
         return localDate.atTime(LocalTime.MAX);
     }
+
+    /**
+     * 将Date转换为当日开始时间(00:00:00.000)
+     */
+    public static Date convertToStartOfDayFromDate(Date date) {
+        if (date == null) {
+            return null;
+        }
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(date);
+        cal.set(Calendar.HOUR_OF_DAY, 0);
+        cal.set(Calendar.MINUTE, 0);
+        cal.set(Calendar.SECOND, 0);
+        cal.set(Calendar.MILLISECOND, 0);
+        return cal.getTime();
+    }
+
+    /**
+     * 将Date转换为当日结束时间(23:59:59.999)
+     */
+    public static Date convertToEndOfDayFromDate(Date date) {
+        if (date == null) {
+            return null;
+        }
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(date);
+        cal.set(Calendar.HOUR_OF_DAY, 23);
+        cal.set(Calendar.MINUTE, 59);
+        cal.set(Calendar.SECOND, 59);
+        cal.set(Calendar.MILLISECOND, 999);
+        return cal.getTime();
+    }
+
+
 }

+ 1 - 1
tr-modules/tr-modules-phototherapy/src/main/resources/mapper/phototherapy/BusClinicRepository.xml

@@ -2,7 +2,7 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.tr.module.phototherapy.common.repository.BusClinicRepository">
 
-    <select id="selectPatientTherapyDetailByPatientUniqueId" resultType="cn.tr.module.phototherapy.common.vo.PatientTherapyDetailVO">
+    <select id="selectPatientTherapyDetailById" resultType="cn.tr.module.phototherapy.common.vo.PatientTherapyDetailVO">
         SELECT
             c.patient_name,
             c.patient_age,