@ -62,40 +62,50 @@
<if test= "inputStatus !=null" >
and tpi.input_status=#{inputStatus}
</if>
<if test= "conditionList!=null and conditionList.size()!=0 and conditionListDate!=null and conditionListDate.size() !=0" >
AND tpi.id IN (
SELECT DISTINCT
( t.patient_id )
FROM
(
<trim suffixOverrides= "INTERSECT" >
<foreach collection= "conditionList" item= "item" >
SELECT
tpr.patient_id
FROM
t_patient_record tpr
WHERE
tpr.rec_status = 0
AND tpr.test_questions_id = #{item.testQuestionsId}
AND tpr.contents LIKE concat('%',#{item.contents},'%')
INTERSECT
</foreach>
<foreach collection= "conditionListDate" item= "item1" >
SELECT
tpr.patient_id
FROM
t_patient_record tpr
WHERE
tpr.rec_status = 0
AND tpr.test_questions_id = #{item1.testQuestionsId}
AND tpr.contents > #{item1.startTime}
AND tpr.contents < #{item1.endTime}
INTERSECT
</foreach>
</trim>
) t
)
</if> >
<if test= "(conditionList!=null and conditionList.size()!=0 ) or (conditionListDate != null and conditionListDate.size() !=0 )" >
and tpi.id IN (
SELECT DISTINCT
( t.patient_id )
FROM
(
<trim suffixOverrides= "INTERSECT" >
<if test= "conditionList!=null and conditionList.size()!=0 " >
<foreach collection= "conditionList" item= "item" >
SELECT
tpr.patient_id
FROM
t_patient_record tpr
WHERE
tpr.rec_status = 0
AND tpr.test_questions_id = #{item.testQuestionsId}
<if test= "item.contents!=null and item.contents!=''" >
AND tpr.contents LIKE concat('%',#{item.contents},'%')
</if>
INTERSECT
</foreach>
</if>
<if test= "conditionListDate != null and conditionListDate.size() !=0 " >
<foreach collection= "conditionListDate" item= "item1" >
SELECT
tpr.patient_id
FROM
t_patient_record tpr
WHERE
tpr.rec_status = 0
AND tpr.test_questions_id = #{item1.testQuestionsId}
<if test= "item1.startTime!=null and item1.startTime!=''" >
AND tpr.contents > #{item1.startTime}
</if>
<if test= "item1.endTime!=null and item1.endTime!=''" >
AND tpr.contents < #{item1.endTime}
</if>
INTERSECT
</foreach>
</if>
</trim>
) t
)
</if>
</select>
<select id= "selPatientInformationList" resultType= "com.ccsens.tcm.bean.vo.PatientVo$SelPatient" >
SELECT
@ -147,9 +157,8 @@
<select id= "countAnalysis" resultType= "com.ccsens.tcm.bean.vo.StatisticVo$SelGroupList" >
select if(LOCATE('其他'),'其他',tpr.contents) as content,count(*) as nums from t_patient_information tpi left join t_patient_record tpr on tpi.id=tpr.patient_id and tpr.rec_status=0
where tpi.rec_status=0
and tpi.inpatient_id=#{aLong}
<if test= "id!=null and id!=0" >
and tpr.test_questions_id=#{id}
<if test= "testQuestionsId!=null and testQuestionsId!=0" >
and tpr.test_questions_id=#{testQuestionsId}
</if>
and tpi.id in (
SELECT
@ -158,40 +167,64 @@
t_patient_information tpi left join t_inpatient ti on ti.rec_status=0 and ti.id=tpi.inpatient_id
WHERE
tpi.rec_status = 0
AND tpi.id IN (
SELECT DISTINCT
( t.patient_id )
FROM
(
<trim suffixOverrides= "INTERSECT" >
<foreach collection= "conditionList" item= "item" >
SELECT
tpr.patient_id
FROM
t_patient_record tpr
WHERE
tpr.rec_status = 0
AND tpr.test_questions_id = #{item.testQuestionsId}
AND tpr.contents LIKE concat('%',#{item.contents},'%')
INTERSECT
</foreach>
<foreach collection= "conditionListDate" item= "item1" >
SELECT
tpr.patient_id
FROM
t_patient_record tpr
WHERE
tpr.rec_status = 0
AND tpr.test_questions_id = #{item1.testQuestionsId}
AND tpr.contents > #{item1.startTime}
AND tpr.contents < #{item1.endTime}
INTERSECT
</foreach>
</trim>
) t
)
<if test= "hospitalId!=null and hospitalId !=0 " >
and tpi.hospital_id=#{hospitalId}
</if>
<if test= "hospitalization!=null and hospitalization!=''" >
and tpi.hospitalization like concat('%',#{hospitalization},'%')
</if>
<if test= "inpatientId !=null and inpatientId!=0" >
and tpi.inpatient_id=#{inpatientId}
</if>
<if test= "inputStatus !=null" >
and tpi.input_status=#{inputStatus}
</if>
<if test= "(conditionList!=null and conditionList.size()!=0 ) or (conditionListDate != null and conditionListDate.size() !=0 )" >
and tpi.id IN (
SELECT DISTINCT
( t.patient_id )
FROM
(
<trim suffixOverrides= "INTERSECT" >
<if test= "conditionList!=null and conditionList.size()!=0 " >
<foreach collection= "conditionList" item= "item" >
SELECT
tpr.patient_id
FROM
t_patient_record tpr
WHERE
tpr.rec_status = 0
AND tpr.test_questions_id = #{item.testQuestionsId}
<if test= "item.contents!=null and item.contents!=''" >
AND tpr.contents LIKE concat('%',#{item.contents},'%')
</if>
INTERSECT
</foreach>
</if>
<if test= "conditionListDate != null and conditionListDate.size() !=0 " >
<foreach collection= "conditionListDate" item= "item1" >
SELECT
tpr.patient_id
FROM
t_patient_record tpr
WHERE
tpr.rec_status = 0
AND tpr.test_questions_id = #{item1.testQuestionsId}
<if test= "item1.startTime!=null and item1.startTime!=''" >
AND tpr.contents > #{item1.startTime}
</if>
<if test= "item1.endTime!=null and item1.endTime!=''" >
AND tpr.contents < #{item1.endTime}
</if>
INTERSECT
</foreach>
</if>
</trim>
) t
)
</if>
)
<if test= "id!=null and id!=0" >
<if test= "testQuest ionsI d!=null" >
group by content
</if>
</select>
@ -276,6 +309,5 @@
) t
GROUP BY
t.user_id
>>>>>>> 56dd44ed6563a7cf642ed1ee775eca6980ebe8ca
</select>
</mapper>