|
@@ -11,36 +11,32 @@
|
|
|
c.patient_address,
|
|
c.patient_address,
|
|
|
c.last_treatment_time,
|
|
c.last_treatment_time,
|
|
|
c.group_type,
|
|
c.group_type,
|
|
|
|
|
+ c.is_current_bind as isCurrentBind,
|
|
|
COUNT(DISTINCT DATE (r.therapy_start_time)) as therapy_count,
|
|
COUNT(DISTINCT DATE (r.therapy_start_time)) as therapy_count,
|
|
|
COALESCE(MAX(r_today.therapy_status), 0) as therapy_status,
|
|
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,
|
|
|
|
|
|
|
+ tp.phase_start_time as phaseStartTime,
|
|
|
|
|
+ tp.phase_type as phaseType,
|
|
|
|
|
+ tp.phase_freq as phaseFreq,
|
|
|
|
|
+ tp.phase_duration_min as phaseDurationMin ,
|
|
|
|
|
+ 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
|
|
da.device_alarm as deviceAlarm
|
|
|
FROM bus_clinic c
|
|
FROM bus_clinic c
|
|
|
LEFT JOIN bus_therapy_plan tp ON c.therapy_plan_id = tp.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
|
|
|
|
|
|
|
+ LEFT JOIN bus_therapy_record r ON c.patient_unique_id = r.patient_unique_id AND r.is_delete = 0
|
|
|
|
|
+ LEFT JOIN bus_therapy_record r_today ON c.patient_unique_id = r_today.patient_unique_id
|
|
|
AND r_today.is_delete = 0
|
|
AND r_today.is_delete = 0
|
|
|
AND DATE (r_today.therapy_start_time) = DATE (NOW())
|
|
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
|
|
|
|
|
|
|
+ LEFT JOIN bus_device_alarm da ON da.device_id = c.device_id
|
|
|
WHERE c.patient_unique_id = #{patientUniqueId}
|
|
WHERE c.patient_unique_id = #{patientUniqueId}
|
|
|
AND c.is_delete = 0
|
|
AND c.is_delete = 0
|
|
|
GROUP BY
|
|
GROUP BY
|
|
|
c.patient_name, c.patient_age, c.patient_gender, c.patient_unique_id,
|
|
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.plan_status, da.device_alarm
|
|
|
|
|
|
|
+ c.patient_phone, c.patient_address, c.last_treatment_time, c.group_type,c.is_current_bind,
|
|
|
|
|
+ tp.phase_start_time, tp.phase_type, tp.phase_freq,
|
|
|
|
|
+ tp.phase_duration_min, tp.plan_doctor, c.device_id, c.bind_start_time,tp.plan_status,da.device_alarm
|
|
|
</select>
|
|
</select>
|
|
|
<select id="selectPatientLists" resultType="cn.tr.module.phototherapy.common.vo.PatientTherapyRecordVO"
|
|
<select id="selectPatientLists" resultType="cn.tr.module.phototherapy.common.vo.PatientTherapyRecordVO"
|
|
|
parameterType="cn.tr.module.phototherapy.common.dto.BusPatientListQueryDTO">
|
|
parameterType="cn.tr.module.phototherapy.common.dto.BusPatientListQueryDTO">
|