Просмотр исходного кода

po/dto修改、患者治疗详情查询

G 1 неделя назад
Родитель
Сommit
6968cff48e
28 измененных файлов с 304 добавлено и 39 удалено
  1. 7 0
      tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/controller/BusClinicController.java
  2. 15 0
      tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/controller/BusTherapyRecordController.java
  3. 11 5
      tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/dto/BusClinicDTO.java
  4. 6 2
      tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/dto/BusClinicQueryDTO.java
  5. 2 0
      tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/dto/BusDeviceAlarmDTO.java
  6. 0 4
      tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/dto/BusDeviceDTO.java
  7. 0 4
      tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/dto/BusDeviceHistoryDTO.java
  8. 0 3
      tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/dto/BusDeviceQueryDTO.java
  9. 1 1
      tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/dto/BusTherapyPlanDTO.java
  10. 1 1
      tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/dto/BusTherapyPlanQueryDTO.java
  11. 3 0
      tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/dto/BusTherapyRecordDTO.java
  12. 3 3
      tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/dto/PatientTherapyDetailDTO.java
  13. 3 0
      tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/dto/TherapyRecordDetailDTO.java
  14. 11 0
      tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/dto/TherapyRecordDetailQueryDTO.java
  15. 11 4
      tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/po/BusClinicPO.java
  16. 2 0
      tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/po/BusDeviceHistoryPO.java
  17. 0 4
      tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/po/BusDevicePO.java
  18. 2 0
      tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/po/BusHospitalPO.java
  19. 3 1
      tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/po/BusTherapyPlanPO.java
  20. 5 0
      tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/po/BusTherapyRecordPO.java
  21. 19 0
      tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/repository/BusTherapyRecordRepository.java
  22. 9 0
      tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/service/IBusClinicService.java
  23. 12 0
      tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/service/IBusTherapyRecordService.java
  24. 136 3
      tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/service/impl/BusClinicServiceImpl.java
  25. 0 1
      tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/service/impl/BusDeviceServiceImpl.java
  26. 1 1
      tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/service/impl/BusTherapyPlanServiceImpl.java
  27. 39 0
      tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/service/impl/BusTherapyRecordServiceImpl.java
  28. 2 2
      tr-test/src/main/resources/application.yml

+ 7 - 0
tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/controller/BusClinicController.java

@@ -4,6 +4,7 @@ import cn.dev33.satoken.annotation.SaCheckPermission;
 import cn.tr.core.validation.Insert;
 import cn.tr.core.validation.Insert;
 import cn.tr.core.validation.Update;
 import cn.tr.core.validation.Update;
 import cn.tr.core.pojo.CommonResult;
 import cn.tr.core.pojo.CommonResult;
+import cn.tr.module.phototherapy.common.dto.PatientTherapyDetailDTO;
 import lombok.AllArgsConstructor;
 import lombok.AllArgsConstructor;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.Operation;
@@ -68,4 +69,10 @@ public class BusClinicController extends BaseController{
     public CommonResult<Boolean> delete(@RequestBody Collection<String> ids) {
     public CommonResult<Boolean> delete(@RequestBody Collection<String> ids) {
         return CommonResult.success(busClinicService.removeBusClinicByIds(ids));
         return CommonResult.success(busClinicService.removeBusClinicByIds(ids));
     }
     }
+
+    @Operation(summary = "根据临床id获取患者治疗详情", description = "phototherapy:clinic:query")
+    @GetMapping("/getPatientTherapyDetail/{clinicId}")
+    public CommonResult<PatientTherapyDetailDTO> getPatientTherapyDetail(@PathVariable("clinicId") String clinicId){
+        return CommonResult.success(busClinicService.getPatientTherapyDetailById(clinicId));
+    }
 }
 }

+ 15 - 0
tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/controller/BusTherapyRecordController.java

@@ -4,6 +4,8 @@ import cn.dev33.satoken.annotation.SaCheckPermission;
 import cn.tr.core.validation.Insert;
 import cn.tr.core.validation.Insert;
 import cn.tr.core.validation.Update;
 import cn.tr.core.validation.Update;
 import cn.tr.core.pojo.CommonResult;
 import cn.tr.core.pojo.CommonResult;
+import cn.tr.module.phototherapy.common.dto.TherapyRecordDetailDTO;
+import cn.tr.module.phototherapy.common.dto.TherapyRecordDetailQueryDTO;
 import lombok.AllArgsConstructor;
 import lombok.AllArgsConstructor;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.Operation;
@@ -68,4 +70,17 @@ public class BusTherapyRecordController extends BaseController{
     public CommonResult<Boolean> delete(@RequestBody Collection<String> ids) {
     public CommonResult<Boolean> delete(@RequestBody Collection<String> ids) {
         return CommonResult.success(busTherapyRecordService.removeBusTherapyRecordByIds(ids));
         return CommonResult.success(busTherapyRecordService.removeBusTherapyRecordByIds(ids));
     }
     }
+
+    @Operation(summary = "根据临床id获取患者治疗记录列表", description = "权限: phototherapy:clinic:query")
+    @PostMapping("/getPatientTherapyRecordList/page")
+    public TableDataInfo<TherapyRecordDetailDTO> getPatientTherapyRecordListPage(@RequestBody TherapyRecordDetailQueryDTO query){
+        startPage();
+        return getDataTable(busTherapyRecordService.getPatientTherapyRecordList(
+                query.getClinicId(),
+                query.getStartDate(),
+                query.getEndDate(),
+                query.getTimeRangeType()
+        ));
+    }
+
 }
 }

+ 11 - 5
tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/dto/BusClinicDTO.java

@@ -10,6 +10,7 @@ import lombok.Data;
 import jakarta.validation.constraints.NotBlank;
 import jakarta.validation.constraints.NotBlank;
 import jakarta.validation.constraints.NotNull;
 import jakarta.validation.constraints.NotNull;
 
 
+import java.time.LocalDateTime;
 import java.util.Date;
 import java.util.Date;
 
 
 /**
 /**
@@ -39,7 +40,7 @@ public class BusClinicDTO extends BaseDTO  {
 
 
     @Schema(description = "患者上次治疗时间")
     @Schema(description = "患者上次治疗时间")
     @NotNull(message = "患者上次治疗时间不能为空", groups = {Update.class, Insert.class})
     @NotNull(message = "患者上次治疗时间不能为空", groups = {Update.class, Insert.class})
-    private Date lastTreatmentTime;
+    private LocalDateTime lastTreatmentTime;
 
 
     @Schema(description = "关联治疗方案表(当前阶段)")
     @Schema(description = "关联治疗方案表(当前阶段)")
     @NotBlank(message = "关联治疗方案表(当前阶段)不能为空", groups = {Update.class, Insert.class})
     @NotBlank(message = "关联治疗方案表(当前阶段)不能为空", groups = {Update.class, Insert.class})
@@ -49,13 +50,13 @@ public class BusClinicDTO extends BaseDTO  {
     private String patientName;
     private String patientName;
 
 
     @Schema(description = "患者年龄")
     @Schema(description = "患者年龄")
-    private Integer patentAge;
+    private Integer patientAge;
 
 
     @Schema(description = "患者性别(0女 1男 2未知)")
     @Schema(description = "患者性别(0女 1男 2未知)")
     private Integer patientGender;
     private Integer patientGender;
 
 
     @Schema(description = "患者联系电话")
     @Schema(description = "患者联系电话")
-    private String patentPhone;
+    private String patientPhone;
 
 
     @Schema(description = "患者地址")
     @Schema(description = "患者地址")
     private String patientAddress;
     private String patientAddress;
@@ -74,13 +75,18 @@ public class BusClinicDTO extends BaseDTO  {
 
 
     @Schema(description = "设备与患者的绑定开始时间")
     @Schema(description = "设备与患者的绑定开始时间")
     @NotBlank(message = "设备与患者的绑定开始时间不能为空", groups = {Update.class, Insert.class})
     @NotBlank(message = "设备与患者的绑定开始时间不能为空", groups = {Update.class, Insert.class})
-    private String bindStartTime;
+    private LocalDateTime bindStartTime;
 
 
     @Schema(description = "设备与患者的绑定结束时间")
     @Schema(description = "设备与患者的绑定结束时间")
-    private String bindEndTime;
+    private LocalDateTime bindEndTime;
 
 
     @Schema(description = "是否当前绑定(1=当前绑定,0=历史绑定)")
     @Schema(description = "是否当前绑定(1=当前绑定,0=历史绑定)")
     @NotNull(message = "是否当前绑定不能为空", groups = {Update.class, Insert.class})
     @NotNull(message = "是否当前绑定不能为空", groups = {Update.class, Insert.class})
     private Integer isCurrentBind;
     private Integer isCurrentBind;
 
 
+    @Schema(description = "所属分组(0治疗组 1对照组)")
+    @NotNull(message = "是否当前所属分组不能为空", groups = {Update.class, Insert.class})
+    private Integer groupType;
+
+
 }
 }

+ 6 - 2
tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/dto/BusClinicQueryDTO.java

@@ -41,13 +41,13 @@ public class BusClinicQueryDTO  implements Serializable{
     private String patientName;
     private String patientName;
 
 
     @Schema(description = "患者年龄")
     @Schema(description = "患者年龄")
-    private Integer patentAge;
+    private Integer patientAge;
 
 
     @Schema(description = "患者性别(0女 1男 2未知)")
     @Schema(description = "患者性别(0女 1男 2未知)")
     private Integer patientGender;
     private Integer patientGender;
 
 
     @Schema(description = "患者联系电话")
     @Schema(description = "患者联系电话")
-    private String patentPhone;
+    private String patientPhone;
 
 
     @Schema(description = "患者地址")
     @Schema(description = "患者地址")
     private String patientAddress;
     private String patientAddress;
@@ -69,4 +69,8 @@ public class BusClinicQueryDTO  implements Serializable{
 
 
     @Schema(description = "是否当前绑定(1=当前绑定,0=历史绑定)")
     @Schema(description = "是否当前绑定(1=当前绑定,0=历史绑定)")
     private Integer isCurrentBind;
     private Integer isCurrentBind;
+
+    @Schema(description = "所属分组(0治疗组 1对照组)")
+    private Integer groupType;
+
 }
 }

+ 2 - 0
tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/dto/BusDeviceAlarmDTO.java

@@ -1,6 +1,7 @@
 package cn.tr.module.phototherapy.common.dto;
 package cn.tr.module.phototherapy.common.dto;
 
 
 import cn.tr.core.pojo.BaseDTO;
 import cn.tr.core.pojo.BaseDTO;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.EqualsAndHashCode;
 import lombok.EqualsAndHashCode;
 import lombok.ToString;
 import lombok.ToString;
 import cn.tr.core.validation.Insert;
 import cn.tr.core.validation.Insert;
@@ -33,6 +34,7 @@ public class BusDeviceAlarmDTO extends BaseDTO  {
     @NotBlank(message = "设备唯一编码不能为空", groups = {Update.class, Insert.class})
     @NotBlank(message = "设备唯一编码不能为空", groups = {Update.class, Insert.class})
     private String deviceId;
     private String deviceId;
 
 
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @Schema(description = "设备数据上传时间")
     @Schema(description = "设备数据上传时间")
     private Date uploadTime;
     private Date uploadTime;
 
 

+ 0 - 4
tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/dto/BusDeviceDTO.java

@@ -33,10 +33,6 @@ public class BusDeviceDTO extends BaseDTO  {
     @NotBlank(message = "设备唯一编码不能为空", groups = {Update.class, Insert.class})
     @NotBlank(message = "设备唯一编码不能为空", groups = {Update.class, Insert.class})
     private String deviceId;
     private String deviceId;
 
 
-    @Schema(description = "治疗记录表id")
-    @NotBlank(message = "治疗记录表id不能为空", groups = {Update.class, Insert.class})
-    private String therapyId;
-
     @Schema(description = "sim卡卡号")
     @Schema(description = "sim卡卡号")
     private String simIccid;
     private String simIccid;
 
 

+ 0 - 4
tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/dto/BusDeviceHistoryDTO.java

@@ -37,10 +37,6 @@ public class BusDeviceHistoryDTO extends BaseDTO  {
     @NotBlank(message = "患者唯一标识不能为空", groups = {Update.class, Insert.class})
     @NotBlank(message = "患者唯一标识不能为空", groups = {Update.class, Insert.class})
     private String patientUniqueId;
     private String patientUniqueId;
 
 
-    @Schema(description = "治疗记录表id")
-    @NotBlank(message = "治疗记录表id不能为空", groups = {Update.class, Insert.class})
-    private String therapyId;
-
     @Schema(description = "设备数据标识")
     @Schema(description = "设备数据标识")
     private String classification;
     private String classification;
 
 

+ 0 - 3
tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/dto/BusDeviceQueryDTO.java

@@ -26,9 +26,6 @@ public class BusDeviceQueryDTO  implements Serializable{
     @Schema(description = "设备唯一编码")
     @Schema(description = "设备唯一编码")
     private String deviceId;
     private String deviceId;
 
 
-    @Schema(description = "治疗记录表id")
-    private String therapyId;
-
     @Schema(description = "sim卡卡号")
     @Schema(description = "sim卡卡号")
     private String simIccid;
     private String simIccid;
 
 

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

@@ -53,7 +53,7 @@ public class BusTherapyPlanDTO extends BaseDTO  {
 
 
     @Schema(description = "方案状态(0启用 1等待启用 2终止)")
     @Schema(description = "方案状态(0启用 1等待启用 2终止)")
     @NotNull(message = "方案状态不能为空", groups = {Update.class, Insert.class})
     @NotNull(message = "方案状态不能为空", groups = {Update.class, Insert.class})
-    private Integer therapyStatus;
+    private Integer planStatus;
 
 
     @Schema(description = "医院id")
     @Schema(description = "医院id")
     private String tenantId;
     private String tenantId;

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

@@ -40,7 +40,7 @@ public class BusTherapyPlanQueryDTO  implements Serializable{
     private Integer phaseDurationMin;
     private Integer phaseDurationMin;
 
 
     @Schema(description = "方案状态(0启用 1等待启用 2终止)")
     @Schema(description = "方案状态(0启用 1等待启用 2终止)")
-    private Integer therapyStatus;
+    private Integer planStatus;
 
 
     @Schema(description = "医院id")
     @Schema(description = "医院id")
     private String tenantId;
     private String tenantId;

+ 3 - 0
tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/dto/BusTherapyRecordDTO.java

@@ -1,6 +1,7 @@
 package cn.tr.module.phototherapy.common.dto;
 package cn.tr.module.phototherapy.common.dto;
 
 
 import cn.tr.core.pojo.BaseDTO;
 import cn.tr.core.pojo.BaseDTO;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.EqualsAndHashCode;
 import lombok.EqualsAndHashCode;
 import lombok.ToString;
 import lombok.ToString;
 import cn.tr.core.validation.Insert;
 import cn.tr.core.validation.Insert;
@@ -37,9 +38,11 @@ public class BusTherapyRecordDTO extends BaseDTO  {
     @NotBlank(message = "所绑定的临床id不能为空", groups = {Update.class, Insert.class})
     @NotBlank(message = "所绑定的临床id不能为空", groups = {Update.class, Insert.class})
     private String clinicId;
     private String clinicId;
 
 
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @Schema(description = "光疗开始时间")
     @Schema(description = "光疗开始时间")
     private Date therapyStartTime;
     private Date therapyStartTime;
 
 
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @Schema(description = "光疗结束时间")
     @Schema(description = "光疗结束时间")
     private Date therapyEndTime;
     private Date therapyEndTime;
 
 

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

@@ -48,8 +48,8 @@ public class PatientTherapyDetailDTO {
     @Schema(description = "治疗次数")
     @Schema(description = "治疗次数")
     private Integer therapyCount;
     private Integer therapyCount;
 
 
-    @Schema(description = "依从性")
-    private Integer compliance;
+/*    @Schema(description = "依从性")
+    private Integer compliance;*/
 
 
     @Schema(description = "治疗记录列表")
     @Schema(description = "治疗记录列表")
     private List<TherapyRecordDetailDTO> therapyRecordList;
     private List<TherapyRecordDetailDTO> therapyRecordList;
@@ -57,7 +57,7 @@ public class PatientTherapyDetailDTO {
 
 
     // 光疗方案(来自therapy_plan表)
     // 光疗方案(来自therapy_plan表)
     @Schema(description = "方案开始时间")
     @Schema(description = "方案开始时间")
-    private LocalDateTime createTime;
+    private LocalDateTime startTime;
 
 
     @Schema(description = "干预期")
     @Schema(description = "干预期")
     private String phaseType;
     private String phaseType;

+ 3 - 0
tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/dto/TherapyRecordDetailDTO.java

@@ -1,9 +1,11 @@
 package cn.tr.module.phototherapy.common.dto;
 package cn.tr.module.phototherapy.common.dto;
 
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.v3.oas.annotations.media.Schema;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 import lombok.Data;
 
 
 import java.time.LocalDate;
 import java.time.LocalDate;
+import java.time.LocalDateTime;
 
 
 /**
 /**
  * @ClassName TherapyRecordDetailDTO
  * @ClassName TherapyRecordDetailDTO
@@ -16,6 +18,7 @@ import java.time.LocalDate;
 public class TherapyRecordDetailDTO {
 public class TherapyRecordDetailDTO {
 
 
     @Schema(description = "治疗日期")
     @Schema(description = "治疗日期")
+    @JsonFormat(pattern = "yyyy-MM-dd")
     private LocalDate therapyDate;
     private LocalDate therapyDate;
 
 
     @Schema(description = "干预期")
     @Schema(description = "干预期")

+ 11 - 0
tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/dto/TherapyRecordDetailQueryDTO.java

@@ -4,6 +4,8 @@ import io.swagger.v3.oas.annotations.media.Schema;
 import jakarta.validation.constraints.NotBlank;
 import jakarta.validation.constraints.NotBlank;
 import lombok.Data;
 import lombok.Data;
 
 
+import java.time.LocalDate;
+
 /**
 /**
  * @ClassName TherapyRecordDetailQueryDTO
  * @ClassName TherapyRecordDetailQueryDTO
  * @Description 治疗信息查询参数
  * @Description 治疗信息查询参数
@@ -17,4 +19,13 @@ public class TherapyRecordDetailQueryDTO {
     @Schema(description = "临床ID", required = true)
     @Schema(description = "临床ID", required = true)
     @NotBlank(message = "临床ID不能为空")
     @NotBlank(message = "临床ID不能为空")
     private String clinicId;
     private String clinicId;
+
+    @Schema(description = "开始日期")
+    private LocalDate startDate;
+
+    @Schema(description = "结束日期")
+    private LocalDate endDate;
+
+    @Schema(description = "时间范围类型:0-自定义,1-今日数据,2-最近一周,3-最近两周,4-最近三周,5-最近一月,6-最近半年")
+    private Integer timeRangeType = 0;  // 默认为自定义
 }
 }

+ 11 - 4
tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/po/BusClinicPO.java

@@ -2,6 +2,7 @@ package cn.tr.module.phototherapy.common.po;
 
 
 import cn.tr.core.pojo.TenantPO;
 import cn.tr.core.pojo.TenantPO;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.v3.oas.annotations.media.Schema;
 import io.swagger.v3.oas.annotations.media.Schema;
@@ -51,7 +52,7 @@ public class BusClinicPO extends TenantPO {
 
 
     /** 患者年龄 */
     /** 患者年龄 */
     @Schema(description = "患者年龄")
     @Schema(description = "患者年龄")
-    private Integer patentAge;
+    private Integer patientAge;
 
 
     /** 患者性别(0女 1男 2未知) */
     /** 患者性别(0女 1男 2未知) */
     @Schema(description = "患者性别(0女 1男 2未知)")
     @Schema(description = "患者性别(0女 1男 2未知)")
@@ -59,7 +60,7 @@ public class BusClinicPO extends TenantPO {
 
 
     /** 患者联系电话 */
     /** 患者联系电话 */
     @Schema(description = "患者联系电话")
     @Schema(description = "患者联系电话")
-    private String patentPhone;
+    private String patientPhone;
 
 
     /** 患者地址 */
     /** 患者地址 */
     @Schema(description = "患者地址")
     @Schema(description = "患者地址")
@@ -74,19 +75,25 @@ public class BusClinicPO extends TenantPO {
     private String tenantId;
     private String tenantId;
 
 
     /** 删除标志(0代表存在 1代表删除) */
     /** 删除标志(0代表存在 1代表删除) */
+    @TableLogic
     @Schema(description = "删除标志(0代表存在 1代表删除)")
     @Schema(description = "删除标志(0代表存在 1代表删除)")
     private Integer isDelete;
     private Integer isDelete;
 
 
     /** 设备与患者的绑定开始时间 */
     /** 设备与患者的绑定开始时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @Schema(description = "设备与患者的绑定开始时间")
     @Schema(description = "设备与患者的绑定开始时间")
-    private String bindStartTime;
+    private LocalDateTime  bindStartTime;
 
 
     /** 设备与患者的绑定结束时间 */
     /** 设备与患者的绑定结束时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @Schema(description = "设备与患者的绑定结束时间")
     @Schema(description = "设备与患者的绑定结束时间")
-    private String bindEndTime;
+    private LocalDateTime bindEndTime;
 
 
     /** 是否当前绑定(1=当前绑定,0=历史绑定)*/
     /** 是否当前绑定(1=当前绑定,0=历史绑定)*/
     @Schema(description = "是否当前绑定(1=当前绑定,0=历史绑定)")
     @Schema(description = "是否当前绑定(1=当前绑定,0=历史绑定)")
     private Integer isCurrentBind;
     private Integer isCurrentBind;
 
 
+    @Schema(description = "所属分组(0治疗组 1对照组)")
+    private Integer groupType;
+
 }
 }

+ 2 - 0
tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/po/BusDeviceHistoryPO.java

@@ -2,6 +2,7 @@ package cn.tr.module.phototherapy.common.po;
 
 
 import cn.tr.core.pojo.TenantPO;
 import cn.tr.core.pojo.TenantPO;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.v3.oas.annotations.media.Schema;
 import io.swagger.v3.oas.annotations.media.Schema;
@@ -84,6 +85,7 @@ public class BusDeviceHistoryPO extends TenantPO {
     private String alarmDesc;
     private String alarmDesc;
 
 
     /** 删除标志(0代表存在 1代表删除) */
     /** 删除标志(0代表存在 1代表删除) */
+    @TableLogic
     @Schema(description = "删除标志(0代表存在 1代表删除)")
     @Schema(description = "删除标志(0代表存在 1代表删除)")
     private Integer isDelete;
     private Integer isDelete;
 
 

+ 0 - 4
tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/po/BusDevicePO.java

@@ -32,10 +32,6 @@ public class BusDevicePO extends TenantPO {
     @Schema(description = "设备唯一编码")
     @Schema(description = "设备唯一编码")
     private String deviceId;
     private String deviceId;
 
 
-    /** 治疗记录表id */
-    @Schema(description = "治疗记录表id")
-    private String therapyId;
-
     /** sim卡卡号 */
     /** sim卡卡号 */
     @Schema(description = "sim卡卡号")
     @Schema(description = "sim卡卡号")
     private String simIccid;
     private String simIccid;

+ 2 - 0
tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/po/BusHospitalPO.java

@@ -3,6 +3,7 @@ package cn.tr.module.phototherapy.common.po;
 import cn.tr.core.pojo.TenantPO;
 import cn.tr.core.pojo.TenantPO;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.TableName;
 import io.swagger.v3.oas.annotations.media.Schema;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 import lombok.Data;
@@ -35,6 +36,7 @@ public class BusHospitalPO extends TenantPO {
     private String logoPath;
     private String logoPath;
 
 
     /** 删除标志(0代表存在 1代表删除) */
     /** 删除标志(0代表存在 1代表删除) */
+    @TableLogic
     @Schema(description = "删除标志(0代表存在 1代表删除)")
     @Schema(description = "删除标志(0代表存在 1代表删除)")
     private Integer isDelete;
     private Integer isDelete;
 }
 }

+ 3 - 1
tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/po/BusTherapyPlanPO.java

@@ -2,6 +2,7 @@ package cn.tr.module.phototherapy.common.po;
 
 
 import cn.tr.core.pojo.TenantPO;
 import cn.tr.core.pojo.TenantPO;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.TableName;
 import io.swagger.v3.oas.annotations.media.Schema;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 import lombok.Data;
@@ -51,13 +52,14 @@ public class BusTherapyPlanPO extends TenantPO {
 
 
     /** 方案状态(0启用 1等待启用 2终止) */
     /** 方案状态(0启用 1等待启用 2终止) */
     @Schema(description = "方案状态(0启用 1等待启用 2终止)")
     @Schema(description = "方案状态(0启用 1等待启用 2终止)")
-    private Integer therapyStatus;
+    private Integer planStatus;
 
 
     /** 医院id */
     /** 医院id */
     @Schema(description = "医院id")
     @Schema(description = "医院id")
     private String tenantId;
     private String tenantId;
 
 
     /** 逻辑删除(0存在 1删除) */
     /** 逻辑删除(0存在 1删除) */
+    @TableLogic
     @Schema(description = "逻辑删除(0存在 1删除)")
     @Schema(description = "逻辑删除(0存在 1删除)")
     private Integer isDelete;
     private Integer isDelete;
 
 

+ 5 - 0
tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/po/BusTherapyRecordPO.java

@@ -3,7 +3,9 @@ package cn.tr.module.phototherapy.common.po;
 import cn.tr.core.pojo.TenantPO;
 import cn.tr.core.pojo.TenantPO;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.v3.oas.annotations.media.Schema;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.EqualsAndHashCode;
@@ -38,10 +40,12 @@ public class BusTherapyRecordPO extends TenantPO {
     private String clinicId;
     private String clinicId;
 
 
     /** 光疗开始时间 */
     /** 光疗开始时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @Schema(description = "光疗开始时间")
     @Schema(description = "光疗开始时间")
     private Date therapyStartTime;
     private Date therapyStartTime;
 
 
     /** 光疗结束时间 */
     /** 光疗结束时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @Schema(description = "光疗结束时间")
     @Schema(description = "光疗结束时间")
     private Date therapyEndTime;
     private Date therapyEndTime;
 
 
@@ -74,6 +78,7 @@ public class BusTherapyRecordPO extends TenantPO {
     private String tenantId;
     private String tenantId;
 
 
     /** 删除标志(0存在  1删除) */
     /** 删除标志(0存在  1删除) */
+    @TableLogic
     @Schema(description = "删除标志(0存在  1删除)")
     @Schema(description = "删除标志(0存在  1删除)")
     private Integer isDelete;
     private Integer isDelete;
 }
 }

+ 19 - 0
tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/repository/BusTherapyRecordRepository.java

@@ -1,10 +1,16 @@
 package cn.tr.module.phototherapy.common.repository;
 package cn.tr.module.phototherapy.common.repository;
 
 
+import cn.tr.module.phototherapy.common.vo.TherapyRecordDetailVO;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Mapper;
 import cn.tr.module.phototherapy.common.po.BusTherapyRecordPO;
 import cn.tr.module.phototherapy.common.po.BusTherapyRecordPO;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 import org.springframework.stereotype.Repository;
 
 
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.util.List;
+
 /**
 /**
  * 治疗记录表Mapper接口
  * 治疗记录表Mapper接口
  *
  *
@@ -14,4 +20,17 @@ import org.springframework.stereotype.Repository;
 @Repository
 @Repository
 @Mapper
 @Mapper
 public interface BusTherapyRecordRepository extends BaseMapper<BusTherapyRecordPO> {
 public interface BusTherapyRecordRepository extends BaseMapper<BusTherapyRecordPO> {
+
+
+    /**
+     * 根据临床ID和时间范围查询治疗记录
+     * @param clinicId 临床ID
+     * @param startDateTime 开始时间(LocalDateTime,由QueryParamUtil转换)
+     * @param endDateTime 结束时间(LocalDateTime,由QueryParamUtil转换)
+     * @return 治疗记录列表
+     */
+    List<TherapyRecordDetailVO> selectTherapyRecordWithPlan(
+            @Param("clinicId") String clinicId,
+            @Param("startDateTime") LocalDateTime startDateTime,
+            @Param("endDateTime") LocalDateTime endDateTime);
 }
 }

+ 9 - 0
tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/service/IBusClinicService.java

@@ -2,6 +2,8 @@ package cn.tr.module.phototherapy.common.service;
 
 
 import cn.tr.module.phototherapy.common.dto.BusClinicDTO;
 import cn.tr.module.phototherapy.common.dto.BusClinicDTO;
 import cn.tr.module.phototherapy.common.dto.BusClinicQueryDTO;
 import cn.tr.module.phototherapy.common.dto.BusClinicQueryDTO;
+import cn.tr.module.phototherapy.common.dto.PatientTherapyDetailDTO;
+
 import java.util.*;
 import java.util.*;
 import java.util.Collection;
 import java.util.Collection;
 
 
@@ -52,4 +54,11 @@ public interface IBusClinicService{
      * @date   2026-01-12
      * @date   2026-01-12
      */
      */
     boolean removeBusClinicByIds(Collection<String> ids);
     boolean removeBusClinicByIds(Collection<String> ids);
+
+    /**
+     * 根据临床id获取患者治疗详情
+     * @param   clinicId 临床id
+     * @date    2026-01-20
+     */
+    PatientTherapyDetailDTO getPatientTherapyDetailById(String clinicId);
 }
 }

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

@@ -2,6 +2,10 @@ package cn.tr.module.phototherapy.common.service;
 
 
 import cn.tr.module.phototherapy.common.dto.BusTherapyRecordDTO;
 import cn.tr.module.phototherapy.common.dto.BusTherapyRecordDTO;
 import cn.tr.module.phototherapy.common.dto.BusTherapyRecordQueryDTO;
 import cn.tr.module.phototherapy.common.dto.BusTherapyRecordQueryDTO;
+import cn.tr.module.phototherapy.common.dto.TherapyRecordDetailDTO;
+import jakarta.validation.constraints.NotBlank;
+
+import java.time.LocalDate;
 import java.util.*;
 import java.util.*;
 import java.util.Collection;
 import java.util.Collection;
 
 
@@ -52,4 +56,12 @@ public interface IBusTherapyRecordService{
      * @date   2026-01-13
      * @date   2026-01-13
      */
      */
     boolean removeBusTherapyRecordByIds(Collection<String> ids);
     boolean removeBusTherapyRecordByIds(Collection<String> ids);
+
+    /**
+     * 获取患者治疗记录列表
+     * @param clinicId 临床ID
+     * @return 治疗记录列表
+     */
+    List<TherapyRecordDetailDTO> getPatientTherapyRecordList(String clinicId, LocalDate startDate, LocalDate endDate, Integer timeRangeType);
+
 }
 }

+ 136 - 3
tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/service/impl/BusClinicServiceImpl.java

@@ -1,7 +1,14 @@
 package cn.tr.module.phototherapy.common.service.impl;
 package cn.tr.module.phototherapy.common.service.impl;
 
 
+import cn.tr.module.phototherapy.common.dto.PatientTherapyDetailDTO;
+import cn.tr.module.phototherapy.common.enums.IsCurrentBindEnum;
+import cn.tr.module.phototherapy.common.enums.TherapyStatusEnum;
+import cn.tr.module.phototherapy.common.po.BusTherapyPlanPO;
+import cn.tr.module.phototherapy.common.po.BusTherapyRecordPO;
+import cn.tr.module.phototherapy.common.repository.BusTherapyPlanRepository;
+import cn.tr.module.phototherapy.common.repository.BusTherapyRecordRepository;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.springframework.beans.factory.annotation.Autowired;
+import jakarta.annotation.Resource;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.ObjectUtil;
@@ -12,6 +19,9 @@ import cn.tr.module.phototherapy.common.repository.BusClinicRepository;
 import cn.tr.module.phototherapy.common.po.BusClinicPO;
 import cn.tr.module.phototherapy.common.po.BusClinicPO;
 import cn.tr.module.phototherapy.common.dto.BusClinicDTO;
 import cn.tr.module.phototherapy.common.dto.BusClinicDTO;
 import cn.tr.module.phototherapy.common.dto.BusClinicQueryDTO;
 import cn.tr.module.phototherapy.common.dto.BusClinicQueryDTO;
+
+import java.time.LocalDate;
+import java.time.ZoneId;
 import java.util.*;
 import java.util.*;
 import cn.tr.module.phototherapy.common.service.IBusClinicService;
 import cn.tr.module.phototherapy.common.service.IBusClinicService;
 import cn.tr.module.phototherapy.common.mapper.BusClinicMapper;
 import cn.tr.module.phototherapy.common.mapper.BusClinicMapper;
@@ -26,6 +36,11 @@ import cn.tr.core.exception.TRExcCode;
 @Service
 @Service
 public class BusClinicServiceImpl extends ServiceImpl<BusClinicRepository, BusClinicPO> implements IBusClinicService {
 public class BusClinicServiceImpl extends ServiceImpl<BusClinicRepository, BusClinicPO> implements IBusClinicService {
 
 
+    @Resource
+    private BusTherapyPlanRepository therapyPlanRepository;
+
+    @Resource
+    private BusTherapyRecordRepository therapyRecordRepository;
 
 
 
 
     /**
     /**
@@ -44,9 +59,9 @@ public class BusClinicServiceImpl extends ServiceImpl<BusClinicRepository, BusCl
                     .eq(ObjectUtil.isNotNull(query.getLastTreatmentTime()), BusClinicPO::getLastTreatmentTime, query.getLastTreatmentTime())
                     .eq(ObjectUtil.isNotNull(query.getLastTreatmentTime()), BusClinicPO::getLastTreatmentTime, query.getLastTreatmentTime())
                     .eq(ObjectUtil.isNotNull(query.getTherapyPlanId()), BusClinicPO::getTherapyPlanId, query.getTherapyPlanId())
                     .eq(ObjectUtil.isNotNull(query.getTherapyPlanId()), BusClinicPO::getTherapyPlanId, query.getTherapyPlanId())
                     .like(ObjectUtil.isNotNull(query.getPatientName()), BusClinicPO::getPatientName, query.getPatientName())
                     .like(ObjectUtil.isNotNull(query.getPatientName()), BusClinicPO::getPatientName, query.getPatientName())
-                    .eq(ObjectUtil.isNotNull(query.getPatentAge()), BusClinicPO::getPatentAge, query.getPatentAge())
+                    .eq(ObjectUtil.isNotNull(query.getPatientAge()), BusClinicPO::getPatientAge, query.getPatientAge())
                     .eq(ObjectUtil.isNotNull(query.getPatientGender()), BusClinicPO::getPatientGender, query.getPatientGender())
                     .eq(ObjectUtil.isNotNull(query.getPatientGender()), BusClinicPO::getPatientGender, query.getPatientGender())
-                    .like(ObjectUtil.isNotNull(query.getPatentPhone()), BusClinicPO::getPatentPhone, query.getPatentPhone())
+                    .like(ObjectUtil.isNotNull(query.getPatientPhone()), BusClinicPO::getPatientPhone, query.getPatientPhone())
                     .like(ObjectUtil.isNotNull(query.getPatientAddress()), BusClinicPO::getPatientAddress, query.getPatientAddress())
                     .like(ObjectUtil.isNotNull(query.getPatientAddress()), BusClinicPO::getPatientAddress, query.getPatientAddress())
                     .eq(ObjectUtil.isNotNull(query.getDeviceId()), BusClinicPO::getDeviceId, query.getDeviceId())
                     .eq(ObjectUtil.isNotNull(query.getDeviceId()), BusClinicPO::getDeviceId, query.getDeviceId())
                     .eq(ObjectUtil.isNotNull(query.getTenantId()), BusClinicPO::getTenantId, query.getTenantId())
                     .eq(ObjectUtil.isNotNull(query.getTenantId()), BusClinicPO::getTenantId, query.getTenantId())
@@ -103,4 +118,122 @@ public class BusClinicServiceImpl extends ServiceImpl<BusClinicRepository, BusCl
         }
         }
         return this.removeByIds(ids);
         return this.removeByIds(ids);
     };
     };
+
+    /***
+     * 根据临床表id获取患者治疗详情
+     * @param clinicId
+     * @date 2026-01-20
+     **/
+    @Override
+    public PatientTherapyDetailDTO getPatientTherapyDetailById(String clinicId) {
+        // 查询临床信息
+        BusClinicPO clinicPO = this.getById(clinicId);
+        if (ObjectUtil.isNull(clinicPO)) {
+            throw new ServiceException(TRExcCode.SYSTEM_ERROR_B0001, "临床信息不存在");
+        }
+
+        // 查询治疗方案信息
+        BusTherapyPlanPO therapyPlanPO = therapyPlanRepository.selectById(clinicPO.getTherapyPlanId());
+
+        // 查询治疗记录信息
+        LambdaQueryWrapper<BusTherapyRecordPO> therapyRecordQuery = new LambdaQueryWrapper<>();
+        therapyRecordQuery.eq(BusTherapyRecordPO::getClinicId, clinicId)
+                .eq(BusTherapyRecordPO::getIsDelete, 0)
+                .orderByDesc(BusTherapyRecordPO::getTherapyStartTime);
+
+        List<BusTherapyRecordPO> therapyRecords = therapyRecordRepository.selectList(therapyRecordQuery);
+
+        // 组装患者治疗详情DTO
+        PatientTherapyDetailDTO detailDTO = new PatientTherapyDetailDTO();
+
+        // 设置患者信息(来自bus_clinic表)
+        detailDTO.setPatientName(clinicPO.getPatientName());
+        detailDTO.setPatientAge(clinicPO.getPatientAge());
+        detailDTO.setPatientGender(clinicPO.getPatientGender());
+        detailDTO.setPatientUniqueId(clinicPO.getPatientUniqueId());
+        detailDTO.setPatientPhone(clinicPO.getPatientPhone());
+        detailDTO.setPatientAddress(clinicPO.getPatientAddress());
+        detailDTO.setLastTreatmentTime(clinicPO.getLastTreatmentTime());
+        detailDTO.setGroupType(clinicPO.getGroupType());
+
+        // 统计治疗次数(按天求和)
+        Set<Date> therapyDays = new HashSet<>();
+        if (CollectionUtil.isNotEmpty(therapyRecords)) {
+            for (BusTherapyRecordPO record : therapyRecords) {
+                if (ObjectUtil.isNotNull(record.getTherapyStartTime())) {
+                    therapyDays.add(record.getTherapyStartTime());
+                }
+            }
+        }
+        detailDTO.setTherapyCount(therapyDays.size());
+
+/*        // 计算依从性(这里简化处理,实际需要根据治疗记录和计划计算)
+        detailDTO.setCompliance(0);*/
+
+        // 判断今日治疗状态
+        LocalDate today = LocalDate.now();
+        LambdaQueryWrapper<BusTherapyRecordPO> todayTherapyQuery = new LambdaQueryWrapper<>();
+        todayTherapyQuery.eq(BusTherapyRecordPO::getClinicId, clinicId)
+                .ge(BusTherapyRecordPO::getTherapyStartTime, today.atStartOfDay())
+                .le(BusTherapyRecordPO::getTherapyStartTime, today.atTime(23, 59, 59))
+                .eq(BusTherapyRecordPO::getIsDelete, 0);
+
+        List<BusTherapyRecordPO> todayTherapyRecords = therapyRecordRepository.selectList(todayTherapyQuery);
+        if (CollectionUtil.isEmpty(todayTherapyRecords)) {
+            detailDTO.setTherapyStatus(TherapyStatusEnum.NOT_STARTED.getText()); // 状态为未进行
+        } else {
+            // 根据最新的治疗记录判断状态
+            BusTherapyRecordPO latestTherapyRecord = todayTherapyRecords.get(0);
+            if (ObjectUtil.isNotNull(latestTherapyRecord.getTherapyStatus())) {
+                TherapyStatusEnum statusEnum = TherapyStatusEnum.getByValue(latestTherapyRecord.getTherapyStatus());
+                if (ObjectUtil.isNotNull(statusEnum)) {
+                    detailDTO.setTherapyStatus(statusEnum.getText()); // 不为空,获取当前状态
+                } else {
+                    detailDTO.setTherapyStatus("未知");
+                }
+            } else {
+                detailDTO.setTherapyStatus("未知");
+            }
+        }
+
+        // 设置光疗方案信息
+        if (ObjectUtil.isNotNull(therapyPlanPO)) {
+            // 使用继承的createTime字段
+            if (ObjectUtil.isNotNull(therapyPlanPO.getCreateTime())) {
+                detailDTO.setStartTime(therapyPlanPO.getCreateTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime());
+            }
+            detailDTO.setPhaseType(therapyPlanPO.getPhaseType());
+
+            // 组装治疗方案描述
+            String therapyPlan = "";
+            if (ObjectUtil.isNotNull(therapyPlanPO.getPhaseFreq())) {
+                therapyPlan += therapyPlanPO.getPhaseFreq();
+            }
+            if (ObjectUtil.isNotNull(therapyPlanPO.getPhaseDurationMin())) {
+                therapyPlan += "; 每次" + therapyPlanPO.getPhaseDurationMin() + "min";
+            }
+            detailDTO.setTherapyPlan(therapyPlan);
+
+            detailDTO.setPlanDoctor(therapyPlanPO.getPlanDoctor());
+        }
+
+        // 设置设备信息
+        detailDTO.setDeviceId(clinicPO.getDeviceId());
+
+        // 查询设备绑定信息
+        // 查询设备绑定信息 - 使用clinic表中的isCurrentBind字段判断是否为当前绑定
+        if (ObjectUtil.isNotNull(clinicPO.getDeviceId()) &&
+                ObjectUtil.isNotNull(clinicPO.getIsCurrentBind()) &&
+                clinicPO.getIsCurrentBind().equals(IsCurrentBindEnum.CURRENT_BIND.getValue()) &&
+                ObjectUtil.isNotNull(clinicPO.getBindStartTime())) {
+            // 如果是当前绑定,则显示绑定开始时间
+            detailDTO.setBindStartTime(clinicPO.getBindStartTime());
+        } else {
+            // 如果不是当前绑定,显示无设备
+            detailDTO.setDeviceId(null); // TODO设置为"无设备"等提示信息
+        }
+
+        return detailDTO;
+
+    }
 }
 }

+ 0 - 1
tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/service/impl/BusDeviceServiceImpl.java

@@ -40,7 +40,6 @@ public class BusDeviceServiceImpl extends ServiceImpl<BusDeviceRepository, BusDe
                 this.list(new LambdaQueryWrapper<BusDevicePO>()
                 this.list(new LambdaQueryWrapper<BusDevicePO>()
                     .eq(ObjectUtil.isNotNull(query.getId()), BusDevicePO::getId, query.getId())
                     .eq(ObjectUtil.isNotNull(query.getId()), BusDevicePO::getId, query.getId())
                     .eq(ObjectUtil.isNotNull(query.getDeviceId()), BusDevicePO::getDeviceId, query.getDeviceId())
                     .eq(ObjectUtil.isNotNull(query.getDeviceId()), BusDevicePO::getDeviceId, query.getDeviceId())
-                    .eq(ObjectUtil.isNotNull(query.getTherapyId()), BusDevicePO::getTherapyId, query.getTherapyId())
                     .like(ObjectUtil.isNotNull(query.getSimIccid()), BusDevicePO::getSimIccid, query.getSimIccid())
                     .like(ObjectUtil.isNotNull(query.getSimIccid()), BusDevicePO::getSimIccid, query.getSimIccid())
                     .eq(ObjectUtil.isNotNull(query.getSimMno()), BusDevicePO::getSimMno, query.getSimMno())
                     .eq(ObjectUtil.isNotNull(query.getSimMno()), BusDevicePO::getSimMno, query.getSimMno())
                     .eq(ObjectUtil.isNotNull(query.getEnable()), BusDevicePO::getEnable, query.getEnable())
                     .eq(ObjectUtil.isNotNull(query.getEnable()), BusDevicePO::getEnable, query.getEnable())

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

@@ -47,7 +47,7 @@ public class BusTherapyPlanServiceImpl extends ServiceImpl<BusTherapyPlanReposit
                     .eq(ObjectUtil.isNotNull(query.getPhaseTargetTimes()), BusTherapyPlanPO::getPhaseTargetTimes, query.getPhaseTargetTimes())
                     .eq(ObjectUtil.isNotNull(query.getPhaseTargetTimes()), BusTherapyPlanPO::getPhaseTargetTimes, query.getPhaseTargetTimes())
                     .eq(ObjectUtil.isNotNull(query.getPhaseFreq()), BusTherapyPlanPO::getPhaseFreq, query.getPhaseFreq())
                     .eq(ObjectUtil.isNotNull(query.getPhaseFreq()), BusTherapyPlanPO::getPhaseFreq, query.getPhaseFreq())
                     .eq(ObjectUtil.isNotNull(query.getPhaseDurationMin()), BusTherapyPlanPO::getPhaseDurationMin, query.getPhaseDurationMin())
                     .eq(ObjectUtil.isNotNull(query.getPhaseDurationMin()), BusTherapyPlanPO::getPhaseDurationMin, query.getPhaseDurationMin())
-                    .eq(ObjectUtil.isNotNull(query.getTherapyStatus()), BusTherapyPlanPO::getTherapyStatus, query.getTherapyStatus())
+                    .eq(ObjectUtil.isNotNull(query.getPlanStatus()), BusTherapyPlanPO::getPlanStatus, query.getPlanStatus())
                     .eq(ObjectUtil.isNotNull(query.getIsDelete()), BusTherapyPlanPO::getIsDelete, query.getIsDelete())
                     .eq(ObjectUtil.isNotNull(query.getIsDelete()), BusTherapyPlanPO::getIsDelete, query.getIsDelete())
                     .eq(ObjectUtil.isNotNull(query.getTenantId()), BusTherapyPlanPO::getTenantId, query.getTenantId())
                     .eq(ObjectUtil.isNotNull(query.getTenantId()), BusTherapyPlanPO::getTenantId, query.getTenantId())
                 )
                 )

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

@@ -1,5 +1,13 @@
 package cn.tr.module.phototherapy.common.service.impl;
 package cn.tr.module.phototherapy.common.service.impl;
 
 
+import cn.tr.module.phototherapy.common.dto.TherapyRecordDetailDTO;
+import cn.tr.module.phototherapy.common.handle.TimeRangeHandler;
+import cn.tr.module.phototherapy.common.mapper.TherapyRecordConvertMapper;
+import cn.tr.module.phototherapy.common.po.BusTherapyPlanPO;
+import cn.tr.module.phototherapy.common.repository.BusClinicRepository;
+import cn.tr.module.phototherapy.common.repository.BusTherapyPlanRepository;
+import cn.tr.module.phototherapy.common.utils.QueryParamUtil;
+import cn.tr.module.phototherapy.common.vo.TherapyRecordDetailVO;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import cn.tr.module.phototherapy.common.po.BusClinicPO;
 import cn.tr.module.phototherapy.common.po.BusClinicPO;
@@ -13,6 +21,10 @@ import cn.tr.module.phototherapy.common.repository.BusTherapyRecordRepository;
 import cn.tr.module.phototherapy.common.po.BusTherapyRecordPO;
 import cn.tr.module.phototherapy.common.po.BusTherapyRecordPO;
 import cn.tr.module.phototherapy.common.dto.BusTherapyRecordDTO;
 import cn.tr.module.phototherapy.common.dto.BusTherapyRecordDTO;
 import cn.tr.module.phototherapy.common.dto.BusTherapyRecordQueryDTO;
 import cn.tr.module.phototherapy.common.dto.BusTherapyRecordQueryDTO;
+
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
 import java.util.*;
 import java.util.*;
 import cn.tr.module.phototherapy.common.service.IBusTherapyRecordService;
 import cn.tr.module.phototherapy.common.service.IBusTherapyRecordService;
 import cn.tr.module.phototherapy.common.mapper.BusTherapyRecordMapper;
 import cn.tr.module.phototherapy.common.mapper.BusTherapyRecordMapper;
@@ -28,6 +40,11 @@ import cn.tr.core.exception.TRExcCode;
 @Service
 @Service
 public class BusTherapyRecordServiceImpl extends ServiceImpl<BusTherapyRecordRepository, BusTherapyRecordPO> implements IBusTherapyRecordService {
 public class BusTherapyRecordServiceImpl extends ServiceImpl<BusTherapyRecordRepository, BusTherapyRecordPO> implements IBusTherapyRecordService {
 
 
+    @Resource
+    private BusTherapyRecordRepository therapyRecordRepository;
+
+    @Resource
+    private TherapyRecordConvertMapper therapyRecordConvertMapper;
 
 
     /**
     /**
     * 根据条件查询治疗记录
     * 根据条件查询治疗记录
@@ -105,4 +122,26 @@ public class BusTherapyRecordServiceImpl extends ServiceImpl<BusTherapyRecordRep
         }
         }
         return this.removeByIds(ids);
         return this.removeByIds(ids);
     };
     };
+
+    /**
+     * 获取患者治疗记录列表
+     * @param clinicId 临床ID
+     * @return 治疗记录列表
+     */
+    @Override
+    public List<TherapyRecordDetailDTO> getPatientTherapyRecordList(String clinicId, LocalDate startDate, LocalDate endDate, Integer timeRangeType) {
+        // 处理预设时间范围
+        LocalDate[] dateRange = TimeRangeHandler.handleTimeRange(startDate, endDate, timeRangeType);
+        startDate = dateRange[0];
+        endDate = dateRange[1];
+
+        // 执行多表联查
+        LocalDateTime startDateTime = QueryParamUtil.convertToStartOfDay(startDate);
+        LocalDateTime endDateTime = QueryParamUtil.convertToEndOfDay(endDate);
+
+        List<TherapyRecordDetailVO> results = therapyRecordRepository.selectTherapyRecordWithPlan(clinicId, startDateTime, endDateTime);
+
+        // 使用 Mapper 转换为 DTO
+        return therapyRecordConvertMapper.toTherapyRecordDetailDTOList(results);
+    }
 }
 }

+ 2 - 2
tr-test/src/main/resources/application.yml

@@ -75,8 +75,8 @@ spring:
 mybatis-plus:
 mybatis-plus:
   mapper-locations: classpath*:com/gitee/sunchenbin/mybatis/actable/mapping/*/*.xml,classpath*:mapper/*/*.xml
   mapper-locations: classpath*:com/gitee/sunchenbin/mybatis/actable/mapping/*/*.xml,classpath*:mapper/*/*.xml
   configuration:
   configuration:
-#    log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
-    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+    log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
+    #log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
   global-config:
   global-config:
     db-config:
     db-config:
       logic-delete-value: 1
       logic-delete-value: 1