ソースを参照

方法类修改

G 1 週間 前
コミット
88066d751f
16 ファイル変更107 行追加95 行削除
  1. 2 1
      tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/controller/BusClinicController.java
  2. 1 1
      tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/controller/BusTherapyRecordController.java
  3. 21 8
      tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/dto/PatientTherapyDetailDTO.java
  4. 10 4
      tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/dto/TherapyRecordDetailDTO.java
  5. 3 3
      tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/dto/TherapyRecordDetailQueryDTO.java
  6. 6 0
      tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/mapper/BusClinicMapper.java
  7. 2 1
      tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/repository/BusClinicRepository.java
  8. 2 2
      tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/repository/BusTherapyRecordRepository.java
  9. 2 1
      tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/service/IBusClinicService.java
  10. 2 2
      tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/service/IBusTherapyRecordService.java
  11. 5 45
      tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/service/impl/BusClinicServiceImpl.java
  12. 3 3
      tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/service/impl/BusTherapyRecordServiceImpl.java
  13. 27 9
      tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/vo/PatientTherapyDetailVO.java
  14. 0 2
      tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/vo/TherapyRecordDetailVO.java
  15. 20 12
      tr-modules/tr-modules-phototherapy/src/main/resources/mapper/phototherapy/BusClinicRepository.xml
  16. 1 1
      tr-modules/tr-modules-phototherapy/src/main/resources/mapper/phototherapy/BusTherapyRecordRepository.xml

+ 2 - 1
tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/controller/BusClinicController.java

@@ -6,6 +6,7 @@ import cn.tr.core.validation.Update;
 import cn.tr.core.pojo.CommonResult;
 import cn.tr.module.phototherapy.common.dto.BusPatientListQueryDTO;
 import cn.tr.module.phototherapy.common.dto.PatientTherapyDetailDTO;
+import cn.tr.module.phototherapy.common.vo.PatientTherapyDetailVO;
 import cn.tr.module.phototherapy.common.vo.PatientTherapyRecordVO;
 import lombok.AllArgsConstructor;
 import io.swagger.v3.oas.annotations.tags.Tag;
@@ -74,7 +75,7 @@ public class BusClinicController extends BaseController{
 
     @Operation(summary = "根据临床id获取患者治疗详情", description = "phototherapy:clinic:query")
     @GetMapping("/getPatientTherapyDetail/{patientUniqueId}")
-    public CommonResult<PatientTherapyDetailDTO> getPatientTherapyDetail(@PathVariable("patientUniqueId") String patientUniqueId){
+    public CommonResult<PatientTherapyDetailVO> getPatientTherapyDetail(@PathVariable("patientUniqueId") String patientUniqueId){
         return CommonResult.success(busClinicService.getPatientTherapyDetailById(patientUniqueId));
     }
 }

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

@@ -76,7 +76,7 @@ public class BusTherapyRecordController extends BaseController{
     public TableDataInfo<TherapyRecordDetailDTO> getPatientTherapyRecordListPage(@RequestBody TherapyRecordDetailQueryDTO query){
         startPage();
         return getDataTable(busTherapyRecordService.getPatientTherapyRecordList(
-                query.getClinicId(),
+                query.getPatientUniqueId(),
                 query.getStartDate(),
                 query.getEndDate(),
                 query.getTimeRangeType()

+ 21 - 8
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 cn.tr.module.phototherapy.common.enums.*;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
@@ -26,9 +27,9 @@ public class PatientTherapyDetailDTO {
     private Integer patientAge;
 
     @Schema(description = "患者性别(0女 1男 2未知)")
-    private Integer patientGender;
+    private PatientGenderEnum patientGender;
 
-    @Schema(description = "患者编号")
+    @Schema(description = "患者唯一标识")
     private String patientUniqueId;
 
     @Schema(description = "联系电话")
@@ -41,31 +42,43 @@ public class PatientTherapyDetailDTO {
     private Date lastTreatmentTime;
 
     @Schema(description = "所属分组")
-    private Integer groupType;
+    private GroupTypeEnum groupType;
 
     // 治疗信息(来自bus_therapy_record表统计)
     @Schema(description = "今日治疗状态")
-    private String therapyStatus;
+    private TherapyStatusEnum therapyStatus;
 
     @Schema(description = "治疗次数")
     private Integer therapyCount;
+    
+    @Schema(description = "治疗方案状态")
+    private TherapyPlanStatusEnum therapyPlanStatus;
+
+    @Schema(description = "报警类型")
+    private DeviceAlarmEnum deviceAlarm;
 
 /*    @Schema(description = "依从性")
     private Integer compliance;*/
 
-    @Schema(description = "治疗记录列表")
-    private List<TherapyRecordDetailDTO> therapyRecordList;
+/*    @Schema(description = "治疗记录列表")
+    private List<TherapyRecordDetailDTO> therapyRecordList;*/
 
 
     // 光疗方案(来自therapy_plan表)
     @Schema(description = "方案开始时间")
     private Date startTime;
 
-    @Schema(description = "干预期")
+    @Schema(description = "治疗阶段")
     private String phaseType;
 
+    @Schema(description = "治疗频率")
+    private Integer phaseFreq;
+
     @Schema(description = "治疗方案")
-    private String therapyPlan;
+    private String therapyPlanDesc;
+
+    @Schema(description = "阶段持续时间(分钟)")
+    private Integer phaseDurationMin;
 
     @Schema(description = "创建医生")
     private String planDoctor;

+ 10 - 4
tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/dto/TherapyRecordDetailDTO.java

@@ -20,13 +20,19 @@ public class TherapyRecordDetailDTO {
 
     @Schema(description = "治疗日期")
     @JsonFormat(pattern = "yyyy-MM-dd")
-    private Date therapyDate;
+    private Date therapyStartTime;
 
-    @Schema(description = "干预期")
+    @Schema(description = "阶段类型")
     private String phaseType;
 
-    @Schema(description = "治疗方案")
-    private String therapyPlan;
+    @Schema(description = "阶段频率")
+    private String phaseFreq;
+
+    @Schema(description = "阶段持续时间(分钟)")
+    private String phaseDurationMin;
+
+/*    @Schema(description = "治疗方案")
+    private String therapyPlan;*/
 
     @Schema(description = "累计治疗时间(分钟)")
     private Integer therapyDuration;

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

@@ -17,9 +17,9 @@ import java.util.Date;
 @Schema(description = "治疗记录查询参数")
 public class TherapyRecordDetailQueryDTO {
 
-    @Schema(description = "临床ID", required = true)
-    @NotBlank(message = "临床ID不能为空")
-    private String clinicId;
+    @Schema(description = "患者唯一ID" , required = true)
+    @NotBlank(message = "患者唯一ID不能为空")
+    private String patientUniqueId;
 
     @Schema(description = "开始日期")
     private Date startDate;

+ 6 - 0
tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/mapper/BusClinicMapper.java

@@ -1,7 +1,9 @@
 package cn.tr.module.phototherapy.common.mapper;
 
+import cn.tr.module.phototherapy.common.dto.PatientTherapyDetailDTO;
 import cn.tr.module.phototherapy.common.po.BusClinicPO;
 import cn.tr.module.phototherapy.common.dto.BusClinicDTO;
+import cn.tr.module.phototherapy.common.vo.PatientTherapyDetailVO;
 import org.mapstruct.Mapper;
 import org.mapstruct.factory.Mappers;
 
@@ -24,4 +26,8 @@ public interface BusClinicMapper {
     List<BusClinicDTO> convertDtoList(List<BusClinicPO> source);
 
     List<BusClinicPO> convertPOList(List<BusClinicDTO> source);
+
+    PatientTherapyDetailDTO convertPatientTherapyDetailDTO(PatientTherapyDetailVO source);
+
+    PatientTherapyDetailVO convertPatientTherapyDetailVO(PatientTherapyDetailDTO source);
 }

+ 2 - 1
tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/repository/BusClinicRepository.java

@@ -1,6 +1,7 @@
 package cn.tr.module.phototherapy.common.repository;
 
 import cn.tr.module.phototherapy.common.dto.BusPatientListQueryDTO;
+import cn.tr.module.phototherapy.common.dto.PatientTherapyDetailDTO;
 import cn.tr.module.phototherapy.common.vo.PatientTherapyDetailVO;
 import cn.tr.module.phototherapy.common.vo.PatientTherapyRecordVO;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@@ -25,7 +26,7 @@ public interface BusClinicRepository extends BaseMapper<BusClinicPO> {
      * @param patientUniqueId
      * @return cn.tr.module.phototherapy.common.vo.PatientTherapyDetailVO
      **/
-    PatientTherapyDetailVO selectPatientTherapyDetailById(@Param("patientUniqueId") String patientUniqueId);
+    PatientTherapyDetailDTO selectPatientTherapyDetailById(@Param("patientUniqueId") String patientUniqueId);
 
     /**
      * 根据条件查询患者列表

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

@@ -25,13 +25,13 @@ public interface BusTherapyRecordRepository extends BaseMapper<BusTherapyRecordP
 
     /**
      * 根据临床ID和时间范围查询治疗记录
-     * @param clinicId 临床ID
+      * @param patientUniqueId 患者唯一ID
      * @param startDateTime 开始时间(LocalDateTime,由QueryParamUtil转换)
      * @param endDateTime 结束时间(LocalDateTime,由QueryParamUtil转换)
      * @return 治疗记录列表
      */
     List<TherapyRecordDetailVO> selectTherapyRecordWithPlan(
-            @Param("clinicId") String clinicId,
+            @Param("patientUniqueId") String patientUniqueId,
             @Param("startDateTime") Date startDateTime,
             @Param("endDateTime") Date endDateTime);
 }

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

@@ -4,6 +4,7 @@ import cn.tr.module.phototherapy.common.dto.BusClinicDTO;
 import cn.tr.module.phototherapy.common.dto.BusClinicQueryDTO;
 import cn.tr.module.phototherapy.common.dto.BusPatientListQueryDTO;
 import cn.tr.module.phototherapy.common.dto.PatientTherapyDetailDTO;
+import cn.tr.module.phototherapy.common.vo.PatientTherapyDetailVO;
 import cn.tr.module.phototherapy.common.vo.PatientTherapyRecordVO;
 
 import java.util.*;
@@ -62,5 +63,5 @@ public interface IBusClinicService{
       * @param  patientUniqueId 患者唯一标识
      * @date    2026-01-20
      */
-    PatientTherapyDetailDTO getPatientTherapyDetailById(String patientUniqueId);
+    PatientTherapyDetailVO getPatientTherapyDetailById(String patientUniqueId);
 }

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

@@ -59,9 +59,9 @@ public interface IBusTherapyRecordService{
 
     /**
      * 获取患者治疗记录列表
-     * @param clinicId 临床ID
+      * @param patientUniqueId 患者唯一ID
      * @return 治疗记录列表
      */
-    List<TherapyRecordDetailDTO> getPatientTherapyRecordList(String clinicId, Date startDate, Date endDate, Integer timeRangeType);
+    List<TherapyRecordDetailDTO> getPatientTherapyRecordList(String patientUniqueId, Date startDate, Date endDate, Integer timeRangeType);
 
 }

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

@@ -2,6 +2,7 @@ package cn.tr.module.phototherapy.common.service.impl;
 
 import cn.tr.module.phototherapy.common.dto.BusPatientListQueryDTO;
 import cn.tr.module.phototherapy.common.dto.PatientTherapyDetailDTO;
+import cn.tr.module.phototherapy.common.mapper.BusTherapyRecordMapper;
 import cn.tr.module.phototherapy.common.vo.PatientTherapyDetailVO;
 import cn.tr.module.phototherapy.common.vo.PatientTherapyRecordVO;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -116,55 +117,14 @@ public class BusClinicServiceImpl extends ServiceImpl<BusClinicRepository, BusCl
      * @date 2026-01-20
      **/
     @Override
-    public PatientTherapyDetailDTO getPatientTherapyDetailById(String patientUniqueId) {
+    public PatientTherapyDetailVO getPatientTherapyDetailById(String patientUniqueId) {
         // 通过多表联查获取数据
-        PatientTherapyDetailVO detailVO = busClinicRepository.selectPatientTherapyDetailById(patientUniqueId);
+        PatientTherapyDetailDTO detailDTO = busClinicRepository.selectPatientTherapyDetailById(patientUniqueId);
 
-        if (detailVO == null) {
+        if (detailDTO == null) {
             throw new ServiceException(TRExcCode.SYSTEM_ERROR_B0001, "患者临床信息不存在");
         }
 
-        // 转换为 DTO 并进行必要的业务逻辑处理
-        PatientTherapyDetailDTO detailDTO = new PatientTherapyDetailDTO();
-
-        // 基本信息直接复制
-        detailDTO.setPatientName(detailVO.getPatientName());
-        detailDTO.setPatientAge(detailVO.getPatientAge());
-        detailDTO.setPatientGender(detailVO.getPatientGender());
-        detailDTO.setPatientUniqueId(detailVO.getPatientUniqueId());
-        detailDTO.setPatientPhone(detailVO.getPatientPhone());
-        detailDTO.setPatientAddress(detailVO.getPatientAddress());
-        detailDTO.setLastTreatmentTime(detailVO.getLastTreatmentTime());
-        detailDTO.setGroupType(detailVO.getGroupType());
-        detailDTO.setTherapyCount(detailVO.getTherapyCount());
-        detailDTO.setTherapyStatus(String.valueOf(detailVO.getTherapyStatus())); // 转换为字符串
-        detailDTO.setStartTime(detailVO.getStartTime());
-        detailDTO.setPhaseType(detailVO.getPhaseType());
-
-        // 拼接治疗方案
-        StringBuilder therapyPlan = new StringBuilder();
-        if (detailVO.getPhaseFreq() != null && !detailVO.getPhaseFreq().trim().isEmpty()) {
-            therapyPlan.append(detailVO.getPhaseFreq());
-        }
-        if (detailVO.getPhaseDurationMin() != null) {
-            if (therapyPlan.length() > 0) {
-                therapyPlan.append("; ");
-            }
-            therapyPlan.append("每次").append(detailVO.getPhaseDurationMin()).append("min");
-        }
-        detailDTO.setTherapyPlan(therapyPlan.toString());
-
-        detailDTO.setPlanDoctor(detailVO.getPlanDoctor());
-
-        // 设备信息处理 - 根据当前绑定状态决定是否显示设备
-        if (detailVO.getDeviceId() != null &&
-                detailVO.getBindStartTime() != null) {
-            detailDTO.setDeviceId(detailVO.getDeviceId());
-            detailDTO.setBindStartTime(detailVO.getBindStartTime());
-        } else {
-            detailDTO.setDeviceId(null);
-        }
-
-        return detailDTO;
+        return BusClinicMapper.INSTANCE.convertPatientTherapyDetailVO(detailDTO);
     }
 }

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

@@ -117,11 +117,11 @@ public class BusTherapyRecordServiceImpl extends ServiceImpl<BusTherapyRecordRep
 
     /**
      * 获取患者治疗记录列表
-     * @param clinicId 临床ID
+     * @param patientUniqueId 临床ID
      * @return 治疗记录列表
      */
     @Override
-    public List<TherapyRecordDetailDTO> getPatientTherapyRecordList(String clinicId, Date startDate, Date endDate, Integer timeRangeType) {
+    public List<TherapyRecordDetailDTO> getPatientTherapyRecordList(String patientUniqueId, Date startDate, Date endDate, Integer timeRangeType) {
         // 处理预设时间范围
         Date[] dateRange = TimeRangeHandler.handleTimeRange(startDate, endDate, timeRangeType);
         startDate = dateRange[0];
@@ -131,7 +131,7 @@ public class BusTherapyRecordServiceImpl extends ServiceImpl<BusTherapyRecordRep
         Date startDateTime = QueryParamUtil.convertToStartOfDayFromDate(startDate);
         Date endDateTime = QueryParamUtil.convertToEndOfDayFromDate(endDate);
 
-        List<TherapyRecordDetailVO> results = therapyRecordRepository.selectTherapyRecordWithPlan(clinicId, startDateTime, endDateTime);
+        List<TherapyRecordDetailVO> results = therapyRecordRepository.selectTherapyRecordWithPlan(patientUniqueId, startDateTime, endDateTime);
 
         // 使用 Mapper 转换为 DTO
         return BusTherapyRecordMapper.INSTANCE.toTherapyRecordDetailDTOList(results);

+ 27 - 9
tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/vo/PatientTherapyDetailVO.java

@@ -1,8 +1,11 @@
 package cn.tr.module.phototherapy.common.vo;
 
+import cn.tr.module.phototherapy.common.enums.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 
+
 import java.util.Date;
 
 /**
@@ -24,7 +27,7 @@ public class PatientTherapyDetailVO {
     private Integer patientAge;
 
     @Schema(description = "患者性别")
-    private Integer patientGender;
+    private PatientGenderEnum patientGender;
 
     @Schema(description = "患者唯一标识")
     private String patientUniqueId;
@@ -36,35 +39,50 @@ public class PatientTherapyDetailVO {
     private String patientAddress;
 
     @Schema(description = "最后治疗时间")
+    @JsonFormat(pattern = "yyyy-MM-dd")
     private Date lastTreatmentTime;
 
-    @Schema(description = "分组类型")
-    private Integer groupType;
+    @Schema(description = "所属分组")
+    private GroupTypeEnum groupType;
+
 
+    // 治疗信息(来自bus_therapy_record表统计)
     @Schema(description = "治疗次数")
     private Integer therapyCount;
 
     @Schema(description = "治疗状态")
-    private Integer therapyStatus;
+    private TherapyStatusEnum therapyStatus;
+
+    @Schema(description = "治疗方案状态")
+    private TherapyPlanStatusEnum therapyPlanStatus;
 
+    @Schema(description = "报警类型")
+    private DeviceAlarmEnum deviceAlarm;
+
+
+    // 光疗方案(来自therapy_plan表)
     @Schema(description = "开始时间")
+    @JsonFormat(pattern = "yyyy-MM-dd")
     private Date startTime;
 
-    @Schema(description = "干预期")
+    @Schema(description = "治疗阶段")
     private String phaseType;
 
-    @Schema(description = "阶段频率")
-    private String phaseFreq;
+    @Schema(description = "治疗频率")
+    private Integer phaseFreq;
 
-    @Schema(description = "阶段持续时间(分钟)")
-    private Integer phaseDurationMin;
+    @Schema(description = "治疗方案")
+    private String therapyPlanDesc;
 
     @Schema(description = "方案医生")
     private String planDoctor;
 
+
+    // 设备信息(来自设备表)
     @Schema(description = "设备ID")
     private String deviceId;
 
     @Schema(description = "绑定开始时间")
+    @JsonFormat(pattern = "yyyy-MM-dd")
     private Date bindStartTime;
 }

+ 0 - 2
tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/vo/TherapyRecordDetailVO.java

@@ -4,8 +4,6 @@ import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 
-import java.time.LocalDate;
-import java.time.LocalDateTime;
 import java.util.Date;
 
 

+ 20 - 12
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="selectPatientTherapyDetailById" resultType="cn.tr.module.phototherapy.common.vo.PatientTherapyDetailVO">
+    <select id="selectPatientTherapyDetailById" resultType="cn.tr.module.phototherapy.common.dto.PatientTherapyDetailDTO">
         SELECT c.patient_name,
                c.patient_age,
                c.patient_gender,
@@ -11,28 +11,36 @@
                c.patient_address,
                c.last_treatment_time,
                c.group_type,
-               r.therapy_start_time as therapy_count,
-               r_today.therapy_status   as therapy_status,
-               btp.create_time   as startTime,
-               btp.phase_type,
-               btp.phase_freq,
-               btp.phase_duration_min,
-               btp.plan_doctor,
-               c.device_id,
-               c.bind_start_time
+               COUNT(DISTINCT DATE (r.therapy_start_time)) as therapy_count,
+               COALESCE(MAX(r_today.therapy_status), 0)    as therapy_status,
+               tp.create_time                              as startTime,
+               tp.phase_type,
+               CONCAT(
+                       tp.phase_freq,
+                       ':每次',
+                       COALESCE(CAST(tp.phase_duration_min AS TEXT), ''),
+                       'min'
+               )                                           as therapyPlanDesc,
+               tp.plan_doctor                              as planDoctor,
+               c.device_id                                 as deviceId,
+               c.bind_start_time                           as bindStartTime,
+               tp.plan_status                              as therapyPlanStatus,
+               da.device_alarm                              as deviceAlarm
         FROM bus_clinic c
-                 LEFT JOIN bus_therapy_plan btp ON c.therapy_plan_id = btp.id
+                 LEFT JOIN bus_therapy_plan tp ON c.therapy_plan_id = tp.id
                  LEFT JOIN bus_therapy_record r ON c.id = r.clinic_id AND r.is_delete = 0
                  LEFT JOIN bus_therapy_record r_today ON c.id = r_today.clinic_id
             AND r_today.is_delete = 0
             AND DATE (r_today.therapy_start_time) = DATE (NOW())
+            LEFT JOIN bus_device d ON c.patient_unique_id = d.patient_unique_id
+            LEFT JOIN bus_device_alarm da ON da.device_id = d.device_id
         WHERE c.patient_unique_id = #{patientUniqueId}
           AND c.is_delete = 0
         GROUP BY
             c.patient_name, c.patient_age, c.patient_gender, c.patient_unique_id,
             c.patient_phone, c.patient_address, c.last_treatment_time, c.group_type,
             tp.create_time, tp.phase_type, tp.phase_freq,
-            tp.phase_duration_min, tp.plan_doctor, c.device_id, c.bind_start_time
+            tp.phase_duration_min, tp.plan_doctor, c.device_id, c.bind_start_time, tp.plan_status, da.device_alarm
     </select>
     <select id="selectPatientLists" resultType="cn.tr.module.phototherapy.common.vo.PatientTherapyRecordVO"
             parameterType="cn.tr.module.phototherapy.common.dto.BusPatientListQueryDTO">

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

@@ -22,7 +22,7 @@
         FROM bus_therapy_record r
         LEFT JOIN bus_clinic c ON r.clinic_id = c.id
         LEFT JOIN bus_therapy_plan p ON c.therapy_plan_id = p.id
-        WHERE r.clinic_id = #{clinicId}
+        WHERE c.patient_unique_id = #{patientUniqueId}
         AND r.is_delete = 0
         <if test="startDateTime != null">
             AND r.therapy_start_time >= #{startDateTime}