and (fhr_sjhm = #{paramSjh,jdbcType=VARCHAR} or shr_sjhm = #{paramSjh,jdbcType=VARCHAR})
</if>
<iftest="sfparam != null and sfparam != '' ">
and (
(fhr_sjhm = #{paramSjh,jdbcType=VARCHAR} and cfcs= #{sfparam,jdbcType=VARCHAR} ) or ( shr_sjhm = #{paramSjh,jdbcType=VARCHAR} and ddcs= #{sfparam,jdbcType=VARCHAR})
)
</if>
<iftest="xdsjStart != null and xdsjStart != ''">
and shrq <![CDATA[>=]]> DATE_FORMAT(#{xdsjStart}, '%Y-%m-%d %H:%i:%S')
</if>
<iftest="xdsjEnd != null and xdsjEnd != ''">
and shrq <![CDATA[<=]]> DATE_FORMAT(#{xdsjEnd}, '%Y-%m-%d %H:%i:%S')
</if>
<iftest="yuefrqparam != null and yuefrqparam != ''">
and DATE_FORMAT(shrq,'%Y-%m') = #{yuefrqparam}
</if>
<iftest="rqparam != null and rqparam != ''">
and DATE_FORMAT(shrq,'%Y') = #{rqparam}
</if>
<iftest="sfbr != null and sfbr != '' and sfbr == '1'.toString()">
and fhr_sjhm = #{paramSjh,jdbcType=VARCHAR}
</if>
<iftest="sfbr != null and sfbr != '' and sfbr == '2'.toString()">
and fhr_sjhm != #{paramSjh,jdbcType=VARCHAR}
</if>
<iftest="dzcs != null and dzcs != '' and dzcs == '1'.toString()">
and (( fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} and fhr_dz in ( select name from (
select name,sum(count) count from (
select fhr_dz name, count(fhr_dz) count from tb_db_kdxx t where t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_dz
union all
select shr_dz name, count(shr_dz) count from tb_db_kdxx t where t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_dz
) t group by name having count <![CDATA[<=]]>2
) ss ) ) or ( shr_sjhm=#{paramSjh,jdbcType=VARCHAR} and shr_dz in ( select name from (
select name,sum(count) count from (
select fhr_dz name, count(fhr_dz) count from tb_db_kdxx t where t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_dz
union all
select shr_dz name, count(shr_dz) count from tb_db_kdxx t where t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_dz
) t group by name having count <![CDATA[<=]]>2
) ss ) ) )
</if>
<iftest="dzcs != null and dzcs != '' and dzcs == '2'.toString()">
and (( fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} and fhr_dz in ( select name from (
select name,sum(count) count from (
select fhr_dz name, count(fhr_dz) count from tb_db_kdxx t where t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_dz
union all
select shr_dz name, count(shr_dz) count from tb_db_kdxx t where t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_dz
) t group by name having count =3
) ss ) ) or ( shr_sjhm=#{paramSjh,jdbcType=VARCHAR} and shr_dz in ( select name from (
select name,sum(count) count from (
select fhr_dz name, count(fhr_dz) count from tb_db_kdxx t where t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_dz
union all
select shr_dz name, count(shr_dz) count from tb_db_kdxx t where t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_dz
) t group by name having count =3
) ss ) ) )
</if>
<iftest="dzcs != null and dzcs != '' and dzcs == '3'.toString()">
and (( fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} and fhr_dz in ( select name from (
select name,sum(count) count from (
select fhr_dz name, count(fhr_dz) count from tb_db_kdxx t where t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_dz
union all
select shr_dz name, count(shr_dz) count from tb_db_kdxx t where t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_dz
) t group by name having count =4
) ss ) ) or ( shr_sjhm=#{paramSjh,jdbcType=VARCHAR} and shr_dz in ( select name from (
select name,sum(count) count from (
select fhr_dz name, count(fhr_dz) count from tb_db_kdxx t where t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_dz
union all
select shr_dz name, count(shr_dz) count from tb_db_kdxx t where t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_dz
) t group by name having count =4
) ss ) ) )
</if>
<iftest="dzcs != null and dzcs != '' and dzcs == '4'.toString()">
and (( fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} and fhr_dz in ( select name from (
select name,sum(count) count from (
select fhr_dz name, count(fhr_dz) count from tb_db_kdxx t where t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_dz
union all
select shr_dz name, count(shr_dz) count from tb_db_kdxx t where t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_dz
) t group by name having count >=5
) ss ) ) or ( shr_sjhm=#{paramSjh,jdbcType=VARCHAR} and shr_dz in ( select name from (
select name,sum(count) count from (
select fhr_dz name, count(fhr_dz) count from tb_db_kdxx t where t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_dz
union all
select shr_dz name, count(shr_dz) count from tb_db_kdxx t where t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_dz
) t group by name having count >=5
) ss ) ) )
</if>
<iftest="qmcs != null and qmcs != '' and qmcs == '1'.toString()">
and ((fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} and shr_sjhm in (select name from (
select name,sum(count) count from (
select shr_sjhm name, count(shr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_sjhm
union all
select fhr_sjhm name, count(fhr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_sjhm
) t group by name having count <![CDATA[<=]]>2
) ss) ) or (shr_sjhm=#{paramSjh,jdbcType=VARCHAR} and fhr_sjhm in (select name from (
select name,sum(count) count from (
select shr_sjhm name, count(shr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_sjhm
union all
select fhr_sjhm name, count(fhr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_sjhm
) t group by name having count <![CDATA[<=]]>2
) ss) ) )
</if>
<iftest="qmcs != null and qmcs != '' and qmcs == '2'.toString()">
and ((fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} and shr_sjhm in (select name from (
select name,sum(count) count from (
select shr_sjhm name, count(shr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_sjhm
union all
select fhr_sjhm name, count(fhr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_sjhm
) t group by name having count =3
) ss) ) or (shr_sjhm=#{paramSjh,jdbcType=VARCHAR} and fhr_sjhm in (select name from (
select name,sum(count) count from (
select shr_sjhm name, count(shr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_sjhm
union all
select fhr_sjhm name, count(fhr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_sjhm
) t group by name having count =3
) ss) ) )
</if>
<iftest="qmcs != null and qmcs != '' and qmcs == '3'.toString()">
and ((fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} and shr_sjhm in (select name from (
select name,sum(count) count from (
select shr_sjhm name, count(shr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_sjhm
union all
select fhr_sjhm name, count(fhr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_sjhm
) t group by name having count =4
) ss) ) or (shr_sjhm=#{paramSjh,jdbcType=VARCHAR} and fhr_sjhm in (select name from (
select name,sum(count) count from (
select shr_sjhm name, count(shr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_sjhm
union all
select fhr_sjhm name, count(fhr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_sjhm
) t group by name having count =4
) ss) ) )
</if>
<iftest="qmcs != null and qmcs != '' and qmcs == '4'.toString()">
and ((fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} and shr_sjhm in (select name from (
select name,sum(count) count from (
select shr_sjhm name, count(shr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_sjhm
union all
select fhr_sjhm name, count(fhr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_sjhm
) t group by name having count <![CDATA[>=]]>5
) ss) ) or (shr_sjhm=#{paramSjh,jdbcType=VARCHAR} and fhr_sjhm in (select name from (
select name,sum(count) count from (
select shr_sjhm name, count(shr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_sjhm
union all
select fhr_sjhm name, count(fhr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_sjhm
and (fhr_sjhm = #{paramSjh,jdbcType=VARCHAR} or shr_sjhm = #{paramSjh,jdbcType=VARCHAR})
</if>
<iftest="sfparam != null and sfparam != '' ">
and (
(fhr_sjhm = #{paramSjh,jdbcType=VARCHAR} and cfcs= #{sfparam,jdbcType=VARCHAR} ) or ( shr_sjhm = #{paramSjh,jdbcType=VARCHAR} and ddcs= #{sfparam,jdbcType=VARCHAR})
)
</if>
<iftest="xdsjStart != null and xdsjStart != ''">
and shrq <![CDATA[>=]]> DATE_FORMAT(#{xdsjStart}, '%Y-%m-%d %H:%i:%S')
</if>
<iftest="xdsjEnd != null and xdsjEnd != ''">
and shrq <![CDATA[<=]]> DATE_FORMAT(#{xdsjEnd}, '%Y-%m-%d %H:%i:%S')
</if>
<iftest="yuefrqparam != null and yuefrqparam != ''">
and DATE_FORMAT(shrq,'%Y-%m') = #{yuefrqparam}
</if>
<iftest="rqparam != null and rqparam != ''">
and DATE_FORMAT(shrq,'%Y') = #{rqparam}
</if>
<iftest="sfbr != null and sfbr != '' and sfbr == '1'.toString()">
and fhr_sjhm = #{paramSjh,jdbcType=VARCHAR}
</if>
<iftest="sfbr != null and sfbr != '' and sfbr == '2'.toString()">
and fhr_sjhm != #{paramSjh,jdbcType=VARCHAR}
</if>
<iftest="dzcs != null and dzcs != '' and dzcs == '1'.toString()">
and (( fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} and fhr_dz in ( select name from (
select name,sum(count) count from (
select fhr_dz name, count(fhr_dz) count from tb_db_kdxx t where t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_dz
union all
select shr_dz name, count(shr_dz) count from tb_db_kdxx t where t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_dz
) t group by name having count <![CDATA[<=]]>2
) ss ) ) or ( shr_sjhm=#{paramSjh,jdbcType=VARCHAR} and shr_dz in ( select name from (
select name,sum(count) count from (
select fhr_dz name, count(fhr_dz) count from tb_db_kdxx t where t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_dz
union all
select shr_dz name, count(shr_dz) count from tb_db_kdxx t where t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_dz
) t group by name having count <![CDATA[<=]]>2
) ss ) ) )
</if>
<iftest="dzcs != null and dzcs != '' and dzcs == '2'.toString()">
and (( fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} and fhr_dz in ( select name from (
select name,sum(count) count from (
select fhr_dz name, count(fhr_dz) count from tb_db_kdxx t where t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_dz
union all
select shr_dz name, count(shr_dz) count from tb_db_kdxx t where t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_dz
) t group by name having count =3
) ss ) ) or ( shr_sjhm=#{paramSjh,jdbcType=VARCHAR} and shr_dz in ( select name from (
select name,sum(count) count from (
select fhr_dz name, count(fhr_dz) count from tb_db_kdxx t where t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_dz
union all
select shr_dz name, count(shr_dz) count from tb_db_kdxx t where t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_dz
) t group by name having count =3
) ss ) ) )
</if>
<iftest="dzcs != null and dzcs != '' and dzcs == '3'.toString()">
and (( fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} and fhr_dz in ( select name from (
select name,sum(count) count from (
select fhr_dz name, count(fhr_dz) count from tb_db_kdxx t where t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_dz
union all
select shr_dz name, count(shr_dz) count from tb_db_kdxx t where t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_dz
) t group by name having count =4
) ss ) ) or ( shr_sjhm=#{paramSjh,jdbcType=VARCHAR} and shr_dz in ( select name from (
select name,sum(count) count from (
select fhr_dz name, count(fhr_dz) count from tb_db_kdxx t where t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_dz
union all
select shr_dz name, count(shr_dz) count from tb_db_kdxx t where t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_dz
) t group by name having count =4
) ss ) ) )
</if>
<iftest="dzcs != null and dzcs != '' and dzcs == '4'.toString()">
and (( fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} and fhr_dz in ( select name from (
select name,sum(count) count from (
select fhr_dz name, count(fhr_dz) count from tb_db_kdxx t where t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_dz
union all
select shr_dz name, count(shr_dz) count from tb_db_kdxx t where t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_dz
) t group by name having count >=5
) ss ) ) or ( shr_sjhm=#{paramSjh,jdbcType=VARCHAR} and shr_dz in ( select name from (
select name,sum(count) count from (
select fhr_dz name, count(fhr_dz) count from tb_db_kdxx t where t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_dz
union all
select shr_dz name, count(shr_dz) count from tb_db_kdxx t where t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_dz
) t group by name having count >=5
) ss ) ) )
</if>
<iftest="qmcs != null and qmcs != '' and qmcs == '1'.toString()">
and ((fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} and shr_sjhm in (select name from (
select name,sum(count) count from (
select shr_sjhm name, count(shr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_sjhm
union all
select fhr_sjhm name, count(fhr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_sjhm
) t group by name having count <![CDATA[<=]]>2
) ss) ) or (shr_sjhm=#{paramSjh,jdbcType=VARCHAR} and fhr_sjhm in (select name from (
select name,sum(count) count from (
select shr_sjhm name, count(shr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_sjhm
union all
select fhr_sjhm name, count(fhr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_sjhm
) t group by name having count <![CDATA[<=]]>2
) ss) ) )
</if>
<iftest="qmcs != null and qmcs != '' and qmcs == '2'.toString()">
and ((fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} and shr_sjhm in (select name from (
select name,sum(count) count from (
select shr_sjhm name, count(shr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_sjhm
union all
select fhr_sjhm name, count(fhr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_sjhm
) t group by name having count =3
) ss) ) or (shr_sjhm=#{paramSjh,jdbcType=VARCHAR} and fhr_sjhm in (select name from (
select name,sum(count) count from (
select shr_sjhm name, count(shr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_sjhm
union all
select fhr_sjhm name, count(fhr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_sjhm
) t group by name having count =3
) ss) ) )
</if>
<iftest="qmcs != null and qmcs != '' and qmcs == '3'.toString()">
and ((fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} and shr_sjhm in (select name from (
select name,sum(count) count from (
select shr_sjhm name, count(shr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_sjhm
union all
select fhr_sjhm name, count(fhr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_sjhm
) t group by name having count =4
) ss) ) or (shr_sjhm=#{paramSjh,jdbcType=VARCHAR} and fhr_sjhm in (select name from (
select name,sum(count) count from (
select shr_sjhm name, count(shr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_sjhm
union all
select fhr_sjhm name, count(fhr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_sjhm
) t group by name having count =4
) ss) ) )
</if>
<iftest="qmcs != null and qmcs != '' and qmcs == '4'.toString()">
and ((fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} and shr_sjhm in (select name from (
select name,sum(count) count from (
select shr_sjhm name, count(shr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_sjhm
union all
select fhr_sjhm name, count(fhr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_sjhm
) t group by name having count <![CDATA[>=]]>5
) ss) ) or (shr_sjhm=#{paramSjh,jdbcType=VARCHAR} and fhr_sjhm in (select name from (
select name,sum(count) count from (
select shr_sjhm name, count(shr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_sjhm
union all
select fhr_sjhm name, count(fhr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_sjhm
and (fhr_sjhm = #{paramSjh,jdbcType=VARCHAR} or shr_sjhm = #{paramSjh,jdbcType=VARCHAR})
</if>
<iftest="sfparam != null and sfparam != '' ">
and (
(fhr_sjhm = #{paramSjh,jdbcType=VARCHAR} and cfcs= #{sfparam,jdbcType=VARCHAR} ) or ( shr_sjhm = #{paramSjh,jdbcType=VARCHAR} and ddcs= #{sfparam,jdbcType=VARCHAR})
)
</if>
<iftest="xdsjStart != null and xdsjStart != ''">
and shrq <![CDATA[>=]]> DATE_FORMAT(#{xdsjStart}, '%Y-%m-%d %H:%i:%S')
</if>
<iftest="xdsjEnd != null and xdsjEnd != ''">
and shrq <![CDATA[<=]]> DATE_FORMAT(#{xdsjEnd}, '%Y-%m-%d %H:%i:%S')
</if>
<iftest="yuefrqparam != null and yuefrqparam != ''">
and DATE_FORMAT(shrq,'%Y-%m') = #{yuefrqparam}
</if>
<iftest="rqparam != null and rqparam != ''">
and DATE_FORMAT(shrq,'%Y') = #{rqparam}
</if>
<iftest="sfbr != null and sfbr != '' and sfbr == '1'.toString()">
and fhr_sjhm = #{paramSjh,jdbcType=VARCHAR}
</if>
<iftest="sfbr != null and sfbr != '' and sfbr == '2'.toString()">
and fhr_sjhm != #{paramSjh,jdbcType=VARCHAR}
</if>
<iftest="dzcs != null and dzcs != '' and dzcs == '1'.toString()">
and (( fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} and fhr_dz in ( select name from (
select name,sum(count) count from (
select fhr_dz name, count(fhr_dz) count from tb_db_kdxx t where t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_dz
union all
select shr_dz name, count(shr_dz) count from tb_db_kdxx t where t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_dz
) t group by name having count <![CDATA[<=]]>2
) ss ) ) or ( shr_sjhm=#{paramSjh,jdbcType=VARCHAR} and shr_dz in ( select name from (
select name,sum(count) count from (
select fhr_dz name, count(fhr_dz) count from tb_db_kdxx t where t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_dz
union all
select shr_dz name, count(shr_dz) count from tb_db_kdxx t where t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_dz
) t group by name having count <![CDATA[<=]]>2
) ss ) ) )
</if>
<iftest="dzcs != null and dzcs != '' and dzcs == '2'.toString()">
and (( fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} and fhr_dz in ( select name from (
select name,sum(count) count from (
select fhr_dz name, count(fhr_dz) count from tb_db_kdxx t where t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_dz
union all
select shr_dz name, count(shr_dz) count from tb_db_kdxx t where t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_dz
) t group by name having count =3
) ss ) ) or ( shr_sjhm=#{paramSjh,jdbcType=VARCHAR} and shr_dz in ( select name from (
select name,sum(count) count from (
select fhr_dz name, count(fhr_dz) count from tb_db_kdxx t where t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_dz
union all
select shr_dz name, count(shr_dz) count from tb_db_kdxx t where t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_dz
) t group by name having count =3
) ss ) ) )
</if>
<iftest="dzcs != null and dzcs != '' and dzcs == '3'.toString()">
and (( fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} and fhr_dz in ( select name from (
select name,sum(count) count from (
select fhr_dz name, count(fhr_dz) count from tb_db_kdxx t where t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_dz
union all
select shr_dz name, count(shr_dz) count from tb_db_kdxx t where t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_dz
) t group by name having count =4
) ss ) ) or ( shr_sjhm=#{paramSjh,jdbcType=VARCHAR} and shr_dz in ( select name from (
select name,sum(count) count from (
select fhr_dz name, count(fhr_dz) count from tb_db_kdxx t where t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_dz
union all
select shr_dz name, count(shr_dz) count from tb_db_kdxx t where t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_dz
) t group by name having count =4
) ss ) ) )
</if>
<iftest="dzcs != null and dzcs != '' and dzcs == '4'.toString()">
and (( fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} and fhr_dz in ( select name from (
select name,sum(count) count from (
select fhr_dz name, count(fhr_dz) count from tb_db_kdxx t where t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_dz
union all
select shr_dz name, count(shr_dz) count from tb_db_kdxx t where t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_dz
) t group by name having count >=5
) ss ) ) or ( shr_sjhm=#{paramSjh,jdbcType=VARCHAR} and shr_dz in ( select name from (
select name,sum(count) count from (
select fhr_dz name, count(fhr_dz) count from tb_db_kdxx t where t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_dz
union all
select shr_dz name, count(shr_dz) count from tb_db_kdxx t where t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_dz
) t group by name having count >=5
) ss ) ) )
</if>
<iftest="qmcs != null and qmcs != '' and qmcs == '1'.toString()">
and ((fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} and shr_sjhm in (select name from (
select name,sum(count) count from (
select shr_sjhm name, count(shr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_sjhm
union all
select fhr_sjhm name, count(fhr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_sjhm
) t group by name having count <![CDATA[<=]]>2
) ss) ) or (shr_sjhm=#{paramSjh,jdbcType=VARCHAR} and fhr_sjhm in (select name from (
select name,sum(count) count from (
select shr_sjhm name, count(shr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_sjhm
union all
select fhr_sjhm name, count(fhr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_sjhm
) t group by name having count <![CDATA[<=]]>2
) ss) ) )
</if>
<iftest="qmcs != null and qmcs != '' and qmcs == '2'.toString()">
and ((fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} and shr_sjhm in (select name from (
select name,sum(count) count from (
select shr_sjhm name, count(shr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_sjhm
union all
select fhr_sjhm name, count(fhr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_sjhm
) t group by name having count =3
) ss) ) or (shr_sjhm=#{paramSjh,jdbcType=VARCHAR} and fhr_sjhm in (select name from (
select name,sum(count) count from (
select shr_sjhm name, count(shr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_sjhm
union all
select fhr_sjhm name, count(fhr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_sjhm
) t group by name having count =3
) ss) ) )
</if>
<iftest="qmcs != null and qmcs != '' and qmcs == '3'.toString()">
and ((fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} and shr_sjhm in (select name from (
select name,sum(count) count from (
select shr_sjhm name, count(shr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_sjhm
union all
select fhr_sjhm name, count(fhr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_sjhm
) t group by name having count =4
) ss) ) or (shr_sjhm=#{paramSjh,jdbcType=VARCHAR} and fhr_sjhm in (select name from (
select name,sum(count) count from (
select shr_sjhm name, count(shr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_sjhm
union all
select fhr_sjhm name, count(fhr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_sjhm
) t group by name having count =4
) ss) ) )
</if>
<iftest="qmcs != null and qmcs != '' and qmcs == '4'.toString()">
and ((fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} and shr_sjhm in (select name from (
select name,sum(count) count from (
select shr_sjhm name, count(shr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_sjhm
union all
select fhr_sjhm name, count(fhr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_sjhm
) t group by name having count <![CDATA[>=]]>5
) ss) ) or (shr_sjhm=#{paramSjh,jdbcType=VARCHAR} and fhr_sjhm in (select name from (
select name,sum(count) count from (
select shr_sjhm name, count(shr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.fhr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by shr_sjhm
union all
select fhr_sjhm name, count(fhr_sjhm) count from tb_db_kdxx t where t.shr_sjhm!=t.fhr_sjhm and t.shr_sjhm=#{paramSjh,jdbcType=VARCHAR} group by fhr_sjhm