t_patient_information tpi left join t_inpatient ti on ti.rec_status=0 and ti.id=tpi.inpatient_id
t_patient_information tpi left join t_inpatient ti on ti.rec_status=0 and ti.id=tpi.inpatient_id
left join t_hospital th on th.rec_status=0 and th.id=tpi.hospital_id
left join t_hospital th on th.rec_status=0 and th.id=tpi.hospital_id
@ -64,7 +65,7 @@
<iftest="inputStatus !=null">
<iftest="inputStatus !=null">
and tpi.input_status=#{inputStatus}
and tpi.input_status=#{inputStatus}
</if>
</if>
<iftest="(conditionList!=null and conditionList.size()!=0 ) or (conditionListDate != null and conditionListDate.size() !=0 )">
<iftest="(conditionList!=null and conditionList.size()!=0 ) or (conditionListDate != null and conditionListDate.size() !=0 ) or (reportParams != null and reportParams.size() != 0)">
and tpi.id IN (
and tpi.id IN (
SELECT DISTINCT
SELECT DISTINCT
( t.patient_id )
( t.patient_id )
@ -106,10 +107,42 @@
INTERSECT
INTERSECT
</foreach>
</foreach>
</if>
</if>
<iftest="reportParams != null and reportParams.size() != 0">
<foreachcollection="reportParams"item="item">
<iftest="item.code != null and item.code != '' and (item.start != null or item.end != null)">
<iftest="(conditionList!=null and conditionList.size()!=0 ) or (conditionListDate != null and conditionListDate.size() !=0 )">
<iftest="(conditionList!=null and conditionList.size()!=0 ) or (conditionListDate != null and conditionListDate.size() !=0 ) or (reportParams != null and reportParams.size() != 0)">
and tpi.id IN (
and tpi.id IN (
SELECT DISTINCT
SELECT DISTINCT
( t.patient_id )
( t.patient_id )
@ -245,6 +270,37 @@
INTERSECT
INTERSECT
</foreach>
</foreach>
</if>
</if>
<iftest="reportParams != null and reportParams.size() != 0">
<foreachcollection="reportParams"item="item">
<iftest="item.code != null and item.code != '' and (item.start != null or item.end != null)">
select r.time, r.type, r.value, '称重' as name from t_wisdom_car_record r where r.car_id = #{carId} and r.type = 1 and r.time >= #{startTime} and r.time < #{endTime} and r.value <= 200000 and r.rec_status = 0
union
select r.time, r.type, r.value, s.name from t_wisdom_car_record r, t_rfid rfid, t_step s where r.car_id = #{carId} and r.value = rfid.rfid and rfid.step_id = s.id and r.type = 2 and r.time >= #{startTime} and r.time < #{endTime} and r.rec_status = 0