Procházet zdrojové kódy

修改临床根据条件查询接口

zhouzeyu před 1 týdnem
rodič
revize
660b15be8a

+ 87 - 0
tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/dto/BusClinicAddDTO.java

@@ -0,0 +1,87 @@
+package cn.tr.module.phototherapy.common.dto;
+
+import cn.tr.core.pojo.BaseDTO;
+import cn.tr.core.validation.Insert;
+import cn.tr.core.validation.Update;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotNull;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+
+import java.util.Date;
+
+/**
+ * 临床表传输对象
+ *
+ * @author CodeGenerator
+ * @date 2026-01-12
+ **/
+@Data
+@Schema(description = "临床表传输对象")
+@EqualsAndHashCode(callSuper = true)
+@ToString
+public class BusClinicAddDTO extends BaseDTO  {
+    private static final long serialVersionUID = 1L;
+
+    @Schema(description = "患者唯一标识")
+    @NotBlank(message = "患者唯一标识不能为空", groups = {Update.class, Insert.class})
+    private String patientUniqueId;
+
+    @Schema(description = "患者姓名")
+    private String patientName;
+
+    @Schema(description = "患者年龄")
+    private Integer patientAge;
+
+    @Schema(description = "患者性别(0女 1男 2未知)")
+    private Integer patientGender;
+
+    @Schema(description = "患者联系电话")
+    private String patientPhone;
+
+    @Schema(description = "患者地址")
+    private String patientAddress;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Schema(description = "阶段开始时间")
+    private Date phaseStartTime;
+
+    @Schema(description = "阶段类型")
+    private Integer phaseType;
+
+    @Schema(description = "负责医生id")
+    @NotBlank(message = "负责医生id不能为空", groups = {Update.class, Insert.class})
+    private String userId;
+
+    @Schema(description = "设备id")
+    @NotBlank(message = "设备id不能为空", groups = {Update.class, Insert.class})
+    private String deviceId;
+
+    @Schema(description = "删除标志(0代表存在 1代表删除)")
+    @NotNull(message = "删除标志不能为空", groups = {Update.class, Insert.class})
+    private Integer isDelete;
+
+    @Schema(description = "医院id")
+    @NotBlank(message = "医院id不能为空", groups = {Update.class, Insert.class})
+    private String tenantId;
+
+    @Schema(description = "设备与患者的绑定开始时间")
+    @NotBlank(message = "设备与患者的绑定开始时间不能为空", groups = {Update.class, Insert.class})
+    private Date bindStartTime;
+
+    @Schema(description = "设备与患者的绑定结束时间")
+    private Date bindEndTime;
+
+    @Schema(description = "是否当前绑定(1=当前绑定,0=历史绑定)")
+    @NotNull(message = "是否当前绑定不能为空", groups = {Update.class, Insert.class})
+    private Integer isCurrentBind;
+
+    @Schema(description = "所属分组(0治疗组 1对照组)")
+    @NotNull(message = "是否当前所属分组不能为空", groups = {Update.class, Insert.class})
+    private Integer groupType;
+
+
+}

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

@@ -1,6 +1,7 @@
 package cn.tr.module.phototherapy.common.dto;
 
 import cn.tr.core.pojo.BaseDTO;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.EqualsAndHashCode;
 import lombok.ToString;
 import cn.tr.core.validation.Insert;
@@ -10,6 +11,8 @@ import lombok.Data;
 import jakarta.validation.constraints.NotBlank;
 import jakarta.validation.constraints.NotNull;
 
+import java.util.Date;
+
 /**
  * 治疗方案表传输对象
  *
@@ -28,33 +31,35 @@ public class BusTherapyPlanDTO extends BaseDTO  {
     private String id;
 
     @Schema(description = "方案医生")
-    @NotBlank(message = "方案医生不能为空", groups = {Update.class, Insert.class})
     private String planDoctor;
 
     @Schema(description = "方案名称")
-    @NotBlank(message = "方案名称不能为空", groups = {Update.class, Insert.class})
     private String planName;
 
     @Schema(description = "阶段类型")
-    @NotBlank(message = "阶段类型不能为空", groups = {Update.class, Insert.class})
     private String phaseType;
 
     @Schema(description = "阶段目标次数")
-    @NotNull(message = "阶段目标次数不能为空", groups = {Update.class, Insert.class})
     private Integer phaseTargetTimes;
 
-    @Schema(description = "阶段频率(如每日1次/隔日1次/每周3次)")
-    @NotBlank(message = "阶段频率不能为空", groups = {Update.class, Insert.class})
-    private String phaseFreq;
+    @Schema(description = "阶段频率")
+    private Integer phaseFreq;
 
     @Schema(description = "阶段建议时长")
-    @NotNull(message = "阶段建议时长不能为空", groups = {Update.class, Insert.class})
     private Integer phaseDurationMin;
 
     @Schema(description = "方案状态(0启用 1等待启用 2终止)")
-    @NotNull(message = "方案状态不能为空", groups = {Update.class, Insert.class})
     private Integer planStatus;
 
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Schema(description = "阶段开始时间")
+    private Date phaseStartTime;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Schema(description = "阶段结束时间")
+    private Date phaseEndTime;
+
+
     @Schema(description = "医院id")
     private String tenantId;
 

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

@@ -34,7 +34,7 @@ public class BusTherapyPlanQueryDTO  implements Serializable{
     private Integer phaseTargetTimes;
 
     @Schema(description = "阶段频率(如每日1次/隔日1次/每周3次)")
-    private String phaseFreq;
+    private Integer phaseFreq;
 
     @Schema(description = "阶段建议时长")
     private Integer phaseDurationMin;

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

@@ -39,7 +39,7 @@ public class ClinicDetailDTO {
     private String phaseType;
 
     @Schema(description = "阶段频率")
-    private String phaseFreq;
+    private Integer phaseFreq;
 
     @Schema(description = "阶段建议时长(分钟)")
     private Integer phaseDurationMin;

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

@@ -4,11 +4,14 @@ import cn.tr.core.pojo.TenantPO;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableLogic;
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.ToString;
 
+import java.util.Date;
+
 /**
  * 治疗方案表实体
  *
@@ -42,9 +45,9 @@ public class BusTherapyPlanPO extends TenantPO {
     @Schema(description = "阶段目标次数")
     private Integer phaseTargetTimes;
 
-    /** 阶段频率(如每日1次/隔日1次/每周3次) */
-    @Schema(description = "阶段频率(如每日1次/隔日1次/每周3次)")
-    private String phaseFreq;
+    /** 阶段频率*/
+    @Schema(description = "阶段频率")
+    private Integer phaseFreq;
 
     /** 阶段建议时长 */
     @Schema(description = "阶段建议时长")
@@ -54,6 +57,16 @@ public class BusTherapyPlanPO extends TenantPO {
     @Schema(description = "方案状态(0启用 1等待启用 2终止)")
     private Integer planStatus;
 
+    /** 阶段开始时间 */
+    @Schema(description = "阶段开始时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date phaseStartTime;
+
+    /** 阶段结束时间 */
+    @Schema(description = "阶段结束时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date phaseEndTime;
+
     /** 医院id */
     @Schema(description = "医院id")
     private String tenantId;

+ 0 - 4
tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/vo/PatientTherapyDetailVO.java

@@ -3,7 +3,6 @@ package cn.tr.module.phototherapy.common.vo;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 
-import java.time.LocalDateTime;
 import java.util.Date;
 
 /**
@@ -60,9 +59,6 @@ public class PatientTherapyDetailVO {
     @Schema(description = "阶段持续时间(分钟)")
     private Integer phaseDurationMin;
 
-    @Schema(description = "治疗方案")
-    private String therapyPlan;  // 用于存储拼接phaseFreq  phaseDurationMin后的结果
-
     @Schema(description = "方案医生")
     private String planDoctor;
 

+ 0 - 3
tr-modules/tr-modules-phototherapy/src/main/java/cn/tr/module/phototherapy/common/vo/PatientTherapyRecordVO.java

@@ -53,9 +53,6 @@ public class PatientTherapyRecordVO {
     @Schema(description = "设备报警")
     private DeviceAlarmEnum deviceAlarm;
 
-    @Schema(description = "治疗方案")
-    private String therapyPlanDesc;
-
     @Schema(description = "是否绑定")
     private IsCurrentBindEnum isCurrentBind;
 

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

@@ -29,7 +29,7 @@ public class TherapyRecordDetailVO {
     private String phaseType;
 
     @Schema(description = "阶段频率")
-    private String phaseFreq;
+    private Integer phaseFreq;
 
     @Schema(description = "阶段持续时间(分钟)")
     private Integer phaseDurationMin;

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

@@ -11,17 +11,17 @@
                c.patient_address,
                c.last_treatment_time,
                c.group_type,
-               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,
-               tp.phase_freq,
-               tp.phase_duration_min,
-               tp.plan_doctor,
+               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
         FROM bus_clinic c
-                 LEFT JOIN bus_therapy_plan tp ON c.therapy_plan_id = tp.id
+                 LEFT JOIN bus_therapy_plan btp ON c.therapy_plan_id = btp.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
@@ -49,12 +49,8 @@
                bc.is_current_bind,
                btp.phase_type,
                btp.phase_target_times,
-               CONCAT(
-               COALESCE(btp.phase_freq, ''),
-               ':每次',
-               COALESCE(CAST(btp.phase_duration_min AS TEXT), ''),
-               'min'
-                ) as therapyPlanDesc,
+               btp.phase_freq,
+               btp.phase_duration_min,
                btp.plan_status,
                bd.device_id,
                bda.device_alarm