TInsuranceDetailMapper.xml 36.1 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yifu.cloud.plus.v1.yifu.insurances.mapper.TInsuranceDetailMapper">

    <resultMap id="BaseResultMap" type="com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail">
            <id property="id" column="ID" jdbcType="VARCHAR"/>
            <result property="empName" column="EMP_NAME" jdbcType="VARCHAR"/>
            <result property="empIdcardNo" column="EMP_IDCARD_NO" jdbcType="VARCHAR"/>
            <result property="deptNo" column="DEPT_NO" jdbcType="VARCHAR"/>
李灿灿's avatar
李灿灿 committed
12
            <result property="post" column="POST" jdbcType="VARCHAR"/>
13
            <result property="insuranceCompanyName" column="INSURANCE_COMPANY_NAME" jdbcType="VARCHAR"/>
李灿灿's avatar
李灿灿 committed
14 15
            <result property="insuranceTypeName" column="INSURANCE_TYPE_NAME" jdbcType="VARCHAR"/>
            <result property="insuranceTypeId" column="INSURANCE_TYPE_ID" jdbcType="BIGINT"/>
16
            <result property="buyStandard" column="BUY_STANDARD" jdbcType="VARCHAR"/>
李灿灿's avatar
李灿灿 committed
17 18
            <result property="medicalQuota" column="MEDICAL_QUOTA" jdbcType="VARCHAR"/>
            <result property="dieDisableQuota" column="DIE_DISABLE_QUOTA" jdbcType="VARCHAR"/>
19 20 21 22 23
            <result property="policyNo" column="POLICY_NO" jdbcType="VARCHAR"/>
            <result property="policyStart" column="POLICY_START" jdbcType="DATE"/>
            <result property="policyEnd" column="POLICY_END" jdbcType="DATE"/>
            <result property="policyEffect" column="POLICY_EFFECT" jdbcType="DATE"/>
            <result property="batchDate" column="BATCH_DATE" jdbcType="TIMESTAMP"/>
李灿灿's avatar
李灿灿 committed
24
			<result property="settleMonth" column="SETTLE_MONTH" jdbcType="VARCHAR"/>
25 26
            <result property="invoiceNo" column="INVOICE_NO" jdbcType="VARCHAR"/>
            <result property="buyType" column="BUY_TYPE" jdbcType="TINYINT"/>
李灿灿's avatar
李灿灿 committed
27
            <result property="insuranceProvince" column="INSURANCE_PROVINCE" jdbcType="TINYINT"/>
李灿灿's avatar
李灿灿 committed
28
            <result property="insuranceProvinceName" column="INSURANCE_PROVINCE_NAME" jdbcType="VARCHAR"/>
李灿灿's avatar
李灿灿 committed
29
            <result property="insuranceCity" column="INSURANCE_CITY" jdbcType="TINYINT"/>
李灿灿's avatar
李灿灿 committed
30
            <result property="insuranceCityName" column="INSURANCE_CITY_NAME" jdbcType="VARCHAR"/>
李灿灿's avatar
李灿灿 committed
31
            <result property="insuranceHandleProvince" column="INSURANCE_HANDLE_PROVINCE" jdbcType="TINYINT"/>
李灿灿's avatar
李灿灿 committed
32
            <result property="insuranceHandleProvinceName" column="INSURANCE_HANDLE_PROVINCE_NAME" jdbcType="VARCHAR"/>
李灿灿's avatar
李灿灿 committed
33
            <result property="insuranceHandleCity" column="INSURANCE_HANDLE_CITY" jdbcType="TINYINT"/>
李灿灿's avatar
李灿灿 committed
34 35
            <result property="insuranceHandleCityName" column="INSURANCE_HANDLE_CITY_NAME" jdbcType="VARCHAR"/>
            <result property="settleType" column="SETTLE_TYPE" jdbcType="TINYINT"/>
36 37
            <result property="actualPremium" column="ACTUAL_PREMIUM" jdbcType="DECIMAL"/>
            <result property="estimatePremium" column="ESTIMATE_PREMIUM" jdbcType="DECIMAL"/>
38
            <result property="signFlag" column="SIGN_FLAG" jdbcType="TINYINT"/>
39
            <result property="buyHandleStatus" column="BUY_HANDLE_STATUS" jdbcType="TINYINT"/>
李灿灿's avatar
李灿灿 committed
40
            <result property="defaultSettleId" column="DEFAULT_SETTLE_ID" jdbcType="VARCHAR"/>
41 42 43 44
            <result property="reduceHandleStatus" column="REDUCE_HANDLE_STATUS" jdbcType="TINYINT"/>
            <result property="isUse" column="IS_USE" jdbcType="TINYINT"/>
            <result property="isEffect" column="IS_EFFECT" jdbcType="TINYINT"/>
            <result property="isOverdue" column="IS_OVERDUE" jdbcType="TINYINT"/>
李灿灿's avatar
李灿灿 committed
45
            <result property="remark" column="REMARK" jdbcType="VARCHAR"/>
46 47 48 49 50 51 52 53 54
            <result property="createBy" column="CREATE_BY" jdbcType="VARCHAR"/>
            <result property="createName" column="CREATE_NAME" jdbcType="VARCHAR"/>
            <result property="createTime" column="CREATE_TIME" jdbcType="TIMESTAMP"/>
            <result property="updateBy" column="UPDATE_BY" jdbcType="VARCHAR"/>
            <result property="updateTime" column="UPDATE_TIME" jdbcType="TIMESTAMP"/>
            <result property="deleteFlag" column="DELETE_FLAG" jdbcType="TINYINT"/>
    </resultMap>

    <sql id="Base_Column_List">
李灿灿's avatar
李灿灿 committed
55
        ID,EMP_NAME,
李灿灿's avatar
李灿灿 committed
56
        EMP_IDCARD_NO,DEPT_NO,POST,INSURANCE_COMPANY_NAME,INSURANCE_TYPE_NAME,
李灿灿's avatar
李灿灿 committed
57
        INSURANCE_TYPE_ID,BUY_STANDARD,MEDICAL_QUOTA,DIE_DISABLE_QUOTA,POLICY_NO,
58 59
        POLICY_START,POLICY_END,POLICY_EFFECT,
        BATCH_DATE,SETTLE_MONTH,INVOICE_NO,
李灿灿's avatar
李灿灿 committed
60 61
        BUY_TYPE,INSURANCE_PROVINCE,INSURANCE_PROVINCE_NAME,INSURANCE_CITY,INSURANCE_CITY_NAME,
        INSURANCE_HANDLE_PROVINCE,INSURANCE_HANDLE_PROVINCE_NAME,INSURANCE_HANDLE_CITY,INSURANCE_HANDLE_CITY_NAME,SETTLE_TYPE,
62
        ACTUAL_PREMIUM,ESTIMATE_PREMIUM,SIGN_FLAG,
李灿灿's avatar
李灿灿 committed
63
        BUY_HANDLE_STATUS,DEFAULT_SETTLE_ID,REDUCE_HANDLE_STATUS,
李灿灿's avatar
李灿灿 committed
64
        IS_USE,IS_EFFECT,IS_OVERDUE,REMARK,
65 66 67
        CREATE_BY,CREATE_NAME,CREATE_TIME,
        UPDATE_BY,UPDATE_TIME,DELETE_FLAG
    </sql>
李灿灿's avatar
李灿灿 committed
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
	<select id="getInsuranceListPage" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceListVO">
		select detail.id as id,
		detail.EMP_NAME as empName,
		detail.EMP_IDCARD_NO as empIdcardNo,
		detail.BUY_TYPE as buyType,
		detail.POST as post,
		detail.DEPT_NO as deptNo,
		detail.POLICY_START as policyStart,
		detail.POLICY_END as policyEnd,
		detail.INSURANCE_COMPANY_NAME as insuranceCompanyName,
		detail.INSURANCE_TYPE_NAME as insuranceTypeName,
	    detail.BUY_STANDARD as buyStandard,
		detail.CREATE_NAME as createName,
		detail.BUY_HANDLE_STATUS as buyHandleStatus,
		detail.SETTLE_TYPE as settleType,
李灿灿's avatar
李灿灿 committed
83 84 85 86
		detail.SETTLE_MONTH as settleMonth
		from t_insurance_detail detail
		where detail.DELETE_FLAG = 0
		<if test="param.deptNo != null and param.deptNo.trim() != ''">
87
			and detail.DEPT_NO like concat('%',replace(replace(#{param.deptNo},'_','\_'),'%','\%'),'%')
李灿灿's avatar
李灿灿 committed
88 89 90 91 92 93 94 95 96 97 98 99 100
		</if>
		<if test="param.buyHandleStatus != null">
			and detail.BUY_HANDLE_STATUS = #{param.buyHandleStatus}
		</if>
		<if test="param.empName != null and param.empName.trim() != ''">
			and detail.EMP_NAME like concat('%',replace(replace(#{param.empName},'_','\_'),'%','\%'),'%')
		</if>
		<if test="param.empIdcardNo != null and param.empIdcardNo.trim() != ''">
			and detail.EMP_IDCARD_NO like concat('%',replace(replace(#{param.empIdcardNo},'_','\_'),'%','\%'),'%')
		</if>
		<if test="param.insuranceCompanyName != null and param.insuranceCompanyName.trim() != ''">
			and detail.INSURANCE_COMPANY_NAME like concat('%',replace(replace(#{param.insuranceCompanyName},'_','\_'),'%','\%'),'%')
		</if>
101 102 103
		<if test="param.insuranceTypeName != null and param.insuranceTypeName.trim() != ''">
			and detail.INSURANCE_TYPE_NAME like concat('%',replace(replace(#{param.insuranceTypeName},'_','\_'),'%','\%'),'%')
		</if>
李灿灿's avatar
李灿灿 committed
104
		<if test="param.buyHandleStatusList != null and param.buyHandleStatusList.size > 0">
105 106 107 108 109
			and detail.BUY_HANDLE_STATUS in
			<foreach collection="param.buyHandleStatusList" index="index" item="item" open="(" separator="," close=")">
				 #{item}
			</foreach>
		</if>
110
		ORDER BY detail.BUY_HANDLE_STATUS,detail.CREATE_TIME DESC
李灿灿's avatar
李灿灿 committed
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
	</select>

	<select id="getInsuranceList" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceListVO">
		select detail.id as id,
		detail.EMP_NAME as empName,
		detail.EMP_IDCARD_NO as empIdcardNo,
		detail.BUY_TYPE as buyType,
		detail.POST as post,
		detail.DEPT_NO as deptNo,
		detail.POLICY_START as policyStart,
		detail.POLICY_END as policyEnd,
		detail.INSURANCE_COMPANY_NAME as insuranceCompanyName,
		detail.INSURANCE_TYPE_NAME as insuranceTypeName,
		detail.BUY_STANDARD as buyStandard,
		detail.CREATE_NAME as createName,
		detail.BUY_HANDLE_STATUS as buyHandleStatus,
		detail.SETTLE_TYPE as settleType,
李灿灿's avatar
李灿灿 committed
128 129 130 131
		detail.SETTLE_MONTH as settleMonth
		from t_insurance_detail detail
		where detail.DELETE_FLAG = 0
		<if test="param.deptNo != null and param.deptNo.trim() != ''">
132
			and detail.DEPT_NO like concat('%',replace(replace(#{param.deptNo},'_','\_'),'%','\%'),'%')
李灿灿's avatar
李灿灿 committed
133 134 135 136 137 138 139 140 141 142 143 144 145
		</if>
		<if test="param.buyHandleStatus != null">
			and detail.BUY_HANDLE_STATUS = #{param.buyHandleStatus}
		</if>
		<if test="param.empName != null and param.empName.trim() != ''">
			and detail.EMP_NAME like concat('%',replace(replace(#{param.empName},'_','\_'),'%','\%'),'%')
		</if>
		<if test="param.empIdcardNo != null and param.empIdcardNo.trim() != ''">
			and detail.EMP_IDCARD_NO like concat('%',replace(replace(#{param.empIdcardNo},'_','\_'),'%','\%'),'%')
		</if>
		<if test="param.insuranceCompanyName != null and param.insuranceCompanyName.trim() != ''">
			and detail.INSURANCE_COMPANY_NAME like concat('%',replace(replace(#{param.insuranceCompanyName},'_','\_'),'%','\%'),'%')
		</if>
146 147 148
		<if test="param.insuranceTypeName != null and param.insuranceTypeName.trim() != ''">
			and detail.INSURANCE_TYPE_NAME like concat('%',replace(replace(#{param.insuranceTypeName},'_','\_'),'%','\%'),'%')
		</if>
李灿灿's avatar
李灿灿 committed
149
		<if test="param.buyHandleStatusList != null and param.buyHandleStatusList.size > 0">
150 151 152 153 154
			and detail.BUY_HANDLE_STATUS in
			<foreach collection="param.buyHandleStatusList" index="index" item="item" open="(" separator="," close=")">
				#{item}
			</foreach>
		</if>
155
		ORDER BY detail.BUY_HANDLE_STATUS,detail.CREATE_TIME DESC
李灿灿's avatar
李灿灿 committed
156
	</select>
李灿灿's avatar
李灿灿 committed
157 158 159

	<select id="getInsuranceDetailById" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceDetailVO">
		select
李灿灿's avatar
李灿灿 committed
160
		detail.id as id,
李灿灿's avatar
李灿灿 committed
161 162 163 164 165 166 167 168 169 170
		detail.EMP_NAME as empName,
		detail.EMP_IDCARD_NO as empIdcardNo,
		detail.BUY_TYPE as buyType,
		detail.DEPT_NO as deptNo,
		detail.POST as post,
		detail.POLICY_START as policyStart,
		detail.POLICY_END as policyEnd,
		detail.POLICY_EFFECT as policyEffect,
		detail.POLICY_NO as policyNo,
		detail.INSURANCE_TYPE_NAME as insuranceTypeName,
171
		detail.INSURANCE_TYPE_ID as insuranceTypeId,
李灿灿's avatar
李灿灿 committed
172 173 174 175 176 177 178 179 180 181 182 183
		detail.BUY_STANDARD as buyStandard,
		detail.MEDICAL_QUOTA as medicalQuota,
		detail.DIE_DISABLE_QUOTA as dieDisableQuota,
		detail.INSURANCE_COMPANY_NAME as insuranceCompanyName,
		detail.SETTLE_TYPE as premiumType,
		detail.ESTIMATE_PREMIUM as estimatePremium,
		detail.ACTUAL_PREMIUM as actualPremium,
		detail.INVOICE_NO as invoiceNo,
		detail.SETTLE_TYPE as settleType,
		detail.SETTLE_MONTH as settleMonth,
		detail.BUY_HANDLE_STATUS as buyHandleStatus,
		detail.REDUCE_HANDLE_STATUS as reduceHandleStatus,
李灿灿's avatar
李灿灿 committed
184
		tis.SETTLE_HANDLE_STATUS as settleHandleStatus,
李灿灿's avatar
李灿灿 committed
185 186 187 188
		detail.IS_USE as isUse,
		detail.IS_EFFECT as isEffect,
		detail.IS_OVERDUE as isOverdue,
		detail.INSURANCE_PROVINCE_NAME as insuranceProvinceName,
李灿灿's avatar
李灿灿 committed
189
		detail.INSURANCE_PROVINCE as insuranceProvince,
李灿灿's avatar
李灿灿 committed
190
		detail.INSURANCE_CITY_NAME as insuranceCityName,
李灿灿's avatar
李灿灿 committed
191
		detail.INSURANCE_CITY as insuranceCity,
李灿灿's avatar
李灿灿 committed
192
		detail.INSURANCE_HANDLE_PROVINCE_NAME as insuranceHandleProvinceName,
李灿灿's avatar
李灿灿 committed
193
		detail.INSURANCE_HANDLE_PROVINCE as insuranceHandleProvince,
李灿灿's avatar
李灿灿 committed
194
		detail.INSURANCE_HANDLE_CITY_NAME as insuranceHandleCityName,
李灿灿's avatar
李灿灿 committed
195
		detail.INSURANCE_HANDLE_CITY as insuranceHandleCity,
李灿灿's avatar
李灿灿 committed
196 197 198
		detail.CREATE_NAME as createName,
		detail.CREATE_TIME as createTime
		from t_insurance_detail detail
李灿灿's avatar
李灿灿 committed
199
		left join t_insurance_settle tis on detail.DEFAULT_SETTLE_ID = tis.ID
李灿灿's avatar
李灿灿 committed
200 201
		where detail.ID = #{id}
	</select>
李灿灿's avatar
李灿灿 committed
202

李灿灿's avatar
李灿灿 committed
203 204 205
	<select id="getInsuranceExportListBySelect" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceExportListVO">
		select detail.id as id,
		detail.DEPT_NO as deptNo,
206 207 208 209
		detail.EMP_NAME as empName,
		detail.EMP_IDCARD_NO as empIdcardNo,
		detail.BUY_TYPE as buyType,
		detail.POST as post,
李灿灿's avatar
李灿灿 committed
210 211 212 213
		detail.INSURANCE_PROVINCE_NAME as insuranceProvinceName,
		detail.INSURANCE_CITY_NAME as insuranceCityName,
		detail.INSURANCE_HANDLE_PROVINCE_NAME as insuranceHandleProvinceName,
		detail.INSURANCE_HANDLE_CITY_NAME as insuranceHandleCityName,
214 215 216 217 218
		detail.POLICY_START as policyStart,
		detail.POLICY_END as policyEnd,
		detail.INSURANCE_COMPANY_NAME as insuranceCompanyName,
		detail.INSURANCE_TYPE_NAME as insuranceTypeName,
		detail.BUY_STANDARD as buyStandard,
李灿灿's avatar
李灿灿 committed
219 220 221
		detail.MEDICAL_QUOTA as medicalQuota,
		detail.DIE_DISABLE_QUOTA as dieDisableQuota,
		detail.SETTLE_MONTH as settleMonth,
222
		detail.SETTLE_TYPE as settleType,
李灿灿's avatar
李灿灿 committed
223 224
		detail.CREATE_NAME as createName,
		detail.REMARK as remark
225
		from t_insurance_detail detail
李灿灿's avatar
李灿灿 committed
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256
		where detail.id in
		<foreach collection="idList" index="index" item="item" open="(" separator="," close=")">
			#{item}
		</foreach>
		ORDER BY detail.CREATE_TIME DESC
	</select>

	<select id="getInsuranceExportList" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceExportListVO">
		select detail.id as id,
			detail.DEPT_NO as deptNo,
			detail.EMP_NAME as empName,
			detail.EMP_IDCARD_NO as empIdcardNo,
			detail.BUY_TYPE as buyType,
			detail.POST as post,
			detail.INSURANCE_PROVINCE_NAME as insuranceProvinceName,
			detail.INSURANCE_CITY_NAME as insuranceCityName,
			detail.INSURANCE_HANDLE_PROVINCE_NAME as insuranceHandleProvinceName,
			detail.INSURANCE_HANDLE_CITY_NAME as insuranceHandleCityName,
			detail.POLICY_START as policyStart,
			detail.POLICY_END as policyEnd,
			detail.INSURANCE_COMPANY_NAME as insuranceCompanyName,
			detail.INSURANCE_TYPE_NAME as insuranceTypeName,
			detail.BUY_STANDARD as buyStandard,
			detail.MEDICAL_QUOTA as medicalQuota,
			detail.DIE_DISABLE_QUOTA as dieDisableQuota,
			detail.SETTLE_MONTH as settleMonth,
			detail.SETTLE_TYPE as settleType,
			detail.CREATE_NAME as createName,
			detail.REMARK as remark
		from t_insurance_detail detail
		where detail.DELETE_FLAG = 0 and detail.BUY_HANDLE_STATUS = 1
257 258 259 260 261 262
		<if test="param.empName != null and param.empName.trim() != ''">
			and detail.EMP_NAME like concat('%',replace(replace(#{param.empName},'_','\_'),'%','\%'),'%')
		</if>
		<if test="param.empIdcardNo != null and param.empIdcardNo.trim() != ''">
			and detail.EMP_IDCARD_NO like concat('%',replace(replace(#{param.empIdcardNo},'_','\_'),'%','\%'),'%')
		</if>
李灿灿's avatar
李灿灿 committed
263
		<if test="param.deptNo != null and param.deptNo.trim() != ''">
264
			and detail.DEPT_NO like concat('%',replace(replace(#{param.deptNo},'_','\_'),'%','\%'),'%')
李灿灿's avatar
李灿灿 committed
265
		</if>
266 267 268 269 270
		<if test="param.insuranceCompanyName != null and param.insuranceCompanyName.trim() != ''">
			and detail.INSURANCE_COMPANY_NAME like concat('%',replace(replace(#{param.insuranceCompanyName},'_','\_'),'%','\%'),'%')
		</if>
		ORDER BY detail.CREATE_TIME DESC
	</select>
李灿灿's avatar
李灿灿 committed
271 272

	<!-- ***********************减员办理******************************** -->
273
	<!-- 已投保列表分页查询-->
李灿灿's avatar
李灿灿 committed
274
	<select id="getInsuredListPage" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuredListVo">
275 276 277 278 279 280 281 282 283 284 285 286
		select
			detail.id as id,
			detail.REDUCE_HANDLE_STATUS as reduceHandleStatus,
			detail.EMP_NAME as empName,
			detail.EMP_IDCARD_NO as empIdcardNo,
			detail.BUY_TYPE as buyType,
			detail.DEPT_NO as deptNo,
			detail.POST as post,
			detail.POLICY_START as policyStart,
			detail.POLICY_END as policyEnd,
			detail.POLICY_EFFECT as policyEffect,
			detail.IS_USE as isUse,
287 288
			detail.IS_EFFECT as isEffect,
			detail.IS_OVERDUE as isOverdue,
289 290 291
			detail.INSURANCE_COMPANY_NAME as insuranceCompanyName,
			detail.INSURANCE_TYPE_NAME as insuranceTypeName,
			detail.BUY_STANDARD as buyStandard
292 293
		from
		     t_insurance_detail detail
294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312
		where
			detail.DELETE_FLAG = 0
		and
			detail.BUY_HANDLE_STATUS = 3
		<if test="param.empName != null and param.empName.trim() != ''">
			and detail.EMP_NAME like concat('%',replace(replace(#{param.empName},'_','\_'),'%','\%'),'%')
		</if>
		<if test="param.empIdcardNo != null and param.empIdcardNo.trim() != ''">
			and detail.EMP_IDCARD_NO like concat('%',replace(replace(#{param.empIdcardNo},'_','\_'),'%','\%'),'%')
		</if>
		<if test="param.deptNo != null and param.deptNo.trim() != ''">
			and detail.DEPT_NO like concat('%',replace(replace(#{param.deptNo},'_','\_'),'%','\%'),'%')
		</if>
		<if test="param.insuranceCompanyName != null and param.insuranceCompanyName.trim() != ''">
			and detail.INSURANCE_COMPANY_NAME like concat('%',replace(replace(#{param.insuranceCompanyName},'_','\_'),'%','\%'),'%')
		</if>
		<if test="param.policyNo != null and param.policyNo.trim() != ''">
			and detail.POLICY_NO like concat('%',replace(replace(#{param.policyNo},'_','\_'),'%','\%'),'%')
		</if>
313 314
		<if test="param.policyStart != null and param.policyStart.trim() != '' and param.policyEnd == null and param.policyEnd.trim() == ''">
			AND detail.POLICY_END   <![CDATA[ >= ]]>  concat(#{param.policyStart}, ' 00:00:00')
315
		</if>
316 317 318 319 320 321 322 323 324
		<if test="param.policyEnd != null and param.policyEnd.trim() != '' and param.policyStart == null and param.policyStart.trim() == ''">
			AND detail.POLICY_START <![CDATA[ <= ]]> concat(#{param.policyEnd}, ' 23:59:59')
		</if>
		<if test="param.policyStart != null and param.policyStart.trim() != '' and param.policyEnd != null and param.policyEnd.trim() != ''">
			and (
			(detail.POLICY_START <![CDATA[ <= ]]>  concat(#{param.policyStart}, ' 00:00:00') and detail.POLICY_END <![CDATA[ >= ]]> concat(#{param.policyEnd}, ' 23:59:59')) OR
			(detail.POLICY_START <![CDATA[ >= ]]>  concat(#{param.policyStart}, ' 00:00:00') and detail.POLICY_START <![CDATA[ <= ]]> concat(#{param.policyEnd}, ' 23:59:59')) OR
			(detail.POLICY_END <![CDATA[ >= ]]>  concat(#{param.policyStart}, ' 00:00:00') and detail.POLICY_END <![CDATA[ <= ]]> concat(#{param.policyEnd}, ' 23:59:59'))
				)
325 326 327 328 329 330 331
		</if>
		<if test="param.invoiceNo != null and param.invoiceNo.trim() != ''">
			and detail.INVOICE_NO like concat('%',replace(replace(#{param.invoiceNo},'_','\_'),'%','\%'),'%')
		</if>
		<if test="param.isUse != null">
			and detail.IS_USE = #{param.isUse}
		</if>
332
		<if test="param.isOverdue != null">
333 334 335 336 337 338 339
			and detail.IS_OVERDUE = #{param.isOverdue}
		</if>
		<if test="param.createTime != null and param.createTime.trim() != ''">
			AND detail.CREATE_TIME = concat(#{param.createTime}, ' 00:00:00')
		</if>
		ORDER BY detail.CREATE_TIME DESC
	</select>
340
	<!-- 已投保列表不分页查询-->
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390
	<select id="getInsuredList" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuredListVo">
		select
			detail.id as id,
			detail.EMP_NAME as empName,
			detail.EMP_IDCARD_NO as empIdcardNo,
			detail.BUY_TYPE as buyType,
			detail.DEPT_NO as deptNo,
			detail.POST as post,
			detail.POLICY_START as policyStart,
			detail.POLICY_END as policyEnd,
			detail.INSURANCE_COMPANY_NAME as insuranceCompanyName,
			detail.INSURANCE_TYPE_NAME as insuranceTypeName,
			detail.BUY_STANDARD as buyStandard,
			detail.MEDICAL_QUOTA as medicalQuota,
			detail.DIE_DISABLE_QUOTA as dieDisableQuota,
			detail.ESTIMATE_PREMIUM as estimatePremium,
			detail.ACTUAL_PREMIUM as actualPremium,
			detail.POLICY_NO as policyNo,
			detail.INVOICE_NO as invoiceNo,
			detail.POLICY_EFFECT as policyEffect,
			detail.INSURANCE_PROVINCE_NAME as insuranceProvinceName,
			detail.INSURANCE_CITY_NAME as insuranceCityName,
			detail.INSURANCE_HANDLE_PROVINCE_NAME as insuranceHandleProvinceName,
			detail.INSURANCE_HANDLE_CITY_NAME as insuranceHandleCityName,
			detail.IS_USE as isUse,
			detail.IS_EFFECT as isEffect,
			detail.IS_OVERDUE as isOverdue,
			detail.CREATE_TIME as createTime,
			detail.CREATE_NAME as createName
		from
		    t_insurance_detail detail
		where
		    detail.DELETE_FLAG = 0
		and
			detail.BUY_HANDLE_STATUS = 3
		<if test="param.empName != null and param.empName.trim() != ''">
			and detail.EMP_NAME like concat('%',replace(replace(#{param.empName},'_','\_'),'%','\%'),'%')
		</if>
		<if test="param.empIdcardNo != null and param.empIdcardNo.trim() != ''">
			and detail.EMP_IDCARD_NO like concat('%',replace(replace(#{param.empIdcardNo},'_','\_'),'%','\%'),'%')
		</if>
		<if test="param.deptNo != null and param.deptNo.trim() != ''">
			and detail.DEPT_NO like concat('%',replace(replace(#{param.deptNo},'_','\_'),'%','\%'),'%')
		</if>
		<if test="param.insuranceCompanyName != null and param.insuranceCompanyName.trim() != ''">
			and detail.INSURANCE_COMPANY_NAME like concat('%',replace(replace(#{param.insuranceCompanyName},'_','\_'),'%','\%'),'%')
		</if>
		<if test="param.policyNo != null and param.policyNo.trim() != ''">
			and detail.POLICY_NO like concat('%',replace(replace(#{param.policyNo},'_','\_'),'%','\%'),'%')
		</if>
391 392 393 394 395
		<if test="param.policyStart != null and param.policyStart.trim() != '' and param.policyEnd == null and param.policyEnd.trim() == ''">
			AND detail.POLICY_END   <![CDATA[ >= ]]>  concat(#{param.policyStart}, ' 00:00:00')
		</if>
		<if test="param.policyEnd != null and param.policyEnd.trim() != '' and param.policyStart == null and param.policyStart.trim() == ''">
			AND detail.POLICY_START <![CDATA[ <= ]]> concat(#{param.policyEnd}, ' 23:59:59')
396
		</if>
397 398 399 400 401 402
		<if test="param.policyStart != null and param.policyStart.trim() != '' and param.policyEnd != null and param.policyEnd.trim() != ''">
			and (
			(detail.POLICY_START <![CDATA[ <= ]]>  concat(#{param.policyStart}, ' 00:00:00') and detail.POLICY_END <![CDATA[ >= ]]> concat(#{param.policyEnd}, ' 23:59:59')) OR
			(detail.POLICY_START <![CDATA[ >= ]]>  concat(#{param.policyStart}, ' 00:00:00') and detail.POLICY_START <![CDATA[ <= ]]> concat(#{param.policyEnd}, ' 23:59:59')) OR
			(detail.POLICY_END <![CDATA[ >= ]]>  concat(#{param.policyStart}, ' 00:00:00') and detail.POLICY_END <![CDATA[ <= ]]> concat(#{param.policyEnd}, ' 23:59:59'))
			)
403 404 405 406 407 408 409
		</if>
		<if test="param.invoiceNo != null and param.invoiceNo.trim() != ''">
			and detail.INVOICE_NO like concat('%',replace(replace(#{param.invoiceNo},'_','\_'),'%','\%'),'%')
		</if>
		<if test="param.isUse != null">
			and detail.IS_USE = #{param.isUse}
		</if>
410
		<if test="param.isOverdue != null ">
411 412 413 414 415 416 417
			and detail.IS_OVERDUE = #{param.isOverdue}
		</if>
		<if test="param.createTime != null and param.createTime.trim() != ''">
			AND detail.CREATE_TIME = concat(#{param.createTime}, ' 00:00:00')
		</if>
		ORDER BY detail.CREATE_TIME DESC
	</select>
418
	<!-- 已减员列表分页查询-->
419 420 421 422 423 424 425 426 427 428 429
	<select id="getInsuranceRefundPageList" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceRefundListVo">
		select
		    detail.id as id,
			detail.EMP_NAME as empName,
			detail.EMP_IDCARD_NO as empIdcardNo,
			detail.POST as post,
			detail.DEPT_NO as deptNo,
			detail.INSURANCE_COMPANY_NAME as insuranceCompanyName,
			detail.POLICY_START as policyStart,
			detail.POLICY_END as policyEnd,
			detail.POLICY_NO as policyNo,
430
			refund.CREATE_TIME as refundCreateTime
431
		from
432 433
			t_insurance_detail detail,
			t_insurance_refund refund
434 435
		where
		    detail.DELETE_FLAG = 0
436 437
		and
			detail.ID = refund.INS_DETAIL_ID
438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454
		and
			detail.REDUCE_HANDLE_STATUS = 4
		<if test="param.empName != null and param.empName.trim() != ''">
			and detail.EMP_NAME like concat('%',replace(replace(#{param.empName},'_','\_'),'%','\%'),'%')
		</if>
		<if test="param.empIdcardNo != null and param.empIdcardNo.trim() != ''">
			and detail.EMP_IDCARD_NO like concat('%',replace(replace(#{param.empIdcardNo},'_','\_'),'%','\%'),'%')
		</if>
		<if test="param.deptNo != null and param.deptNo.trim() != ''">
			and detail.DEPT_NO like concat('%',replace(replace(#{param.deptNo},'_','\_'),'%','\%'),'%')
		</if>
		<if test="param.insuranceCompanyName != null and param.insuranceCompanyName.trim() != ''">
			and detail.INSURANCE_COMPANY_NAME like concat('%',replace(replace(#{param.insuranceCompanyName},'_','\_'),'%','\%'),'%')
		</if>
		<if test="param.policyNo != null and param.policyNo.trim() != ''">
			and detail.POLICY_NO like concat('%',replace(replace(#{param.policyNo},'_','\_'),'%','\%'),'%')
		</if>
455 456
		<if test="param.policyStart != null and param.policyStart.trim() != '' and param.policyEnd == null and param.policyEnd.trim() == ''">
			AND detail.POLICY_END   <![CDATA[ >= ]]>  concat(#{param.policyStart}, ' 00:00:00')
457
		</if>
458 459 460 461 462 463 464 465 466
		<if test="param.policyEnd != null and param.policyEnd.trim() != '' and param.policyStart == null and param.policyStart.trim() == ''">
			AND detail.POLICY_START <![CDATA[ <= ]]> concat(#{param.policyEnd}, ' 23:59:59')
		</if>
		<if test="param.policyStart != null and param.policyStart.trim() != '' and param.policyEnd != null and param.policyEnd.trim() != ''">
			and (
			(detail.POLICY_START <![CDATA[ <= ]]>  concat(#{param.policyStart}, ' 00:00:00') and detail.POLICY_END <![CDATA[ >= ]]> concat(#{param.policyEnd}, ' 23:59:59')) OR
			(detail.POLICY_START <![CDATA[ >= ]]>  concat(#{param.policyStart}, ' 00:00:00') and detail.POLICY_START <![CDATA[ <= ]]> concat(#{param.policyEnd}, ' 23:59:59')) OR
			(detail.POLICY_END <![CDATA[ >= ]]>  concat(#{param.policyStart}, ' 00:00:00') and detail.POLICY_END <![CDATA[ <= ]]> concat(#{param.policyEnd}, ' 23:59:59'))
			)
467
		</if>
468
		ORDER BY refund.CREATE_TIME DESC
469
	</select>
470
	<!-- 已减员列表不分页查询-->
471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489
	<select id="getInsuranceRefundList" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceRefundListVo">
		select
			detail.id as id,
			detail.DEPT_NO as deptNo,
			detail.EMP_NAME as empName,
			detail.EMP_IDCARD_NO as empIdcardNo,
			detail.BUY_TYPE as buyType,
			detail.POST as post,
			detail.INSURANCE_PROVINCE_NAME as insuranceProvinceName,
			detail.INSURANCE_CITY_NAME as insuranceCityName,
			detail.INSURANCE_HANDLE_PROVINCE_NAME as insuranceHandleProvinceName,
			detail.INSURANCE_HANDLE_CITY_NAME as insuranceHandleCityName,
			detail.POLICY_START as policyStart,
			detail.POLICY_END as policyEnd,
			detail.INSURANCE_COMPANY_NAME as insuranceCompanyName,
			detail.INSURANCE_TYPE_NAME as insuranceTypeName,
			detail.BUY_STANDARD as buyStandard,
			detail.MEDICAL_QUOTA as medicalQuota,
			detail.DIE_DISABLE_QUOTA as dieDisableQuota,
490
			refund.CREATE_TIME as refundCreateTime
491
		from
492 493
			t_insurance_detail detail,
			t_insurance_refund refund
494
		where
495 496
			detail.ID = refund.INS_DETAIL_ID
		and
497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514
			detail.DELETE_FLAG = 0
		and
			detail.REDUCE_HANDLE_STATUS = 4
		<if test="param.empName != null and param.empName.trim() != ''">
			and detail.EMP_NAME like concat('%',replace(replace(#{param.empName},'_','\_'),'%','\%'),'%')
		</if>
		<if test="param.empIdcardNo != null and param.empIdcardNo.trim() != ''">
			and detail.EMP_IDCARD_NO like concat('%',replace(replace(#{param.empIdcardNo},'_','\_'),'%','\%'),'%')
		</if>
		<if test="param.deptNo != null and param.deptNo.trim() != ''">
			and detail.DEPT_NO like concat('%',replace(replace(#{param.deptNo},'_','\_'),'%','\%'),'%')
		</if>
		<if test="param.insuranceCompanyName != null and param.insuranceCompanyName.trim() != ''">
			and detail.INSURANCE_COMPANY_NAME like concat('%',replace(replace(#{param.insuranceCompanyName},'_','\_'),'%','\%'),'%')
		</if>
		<if test="param.policyNo != null and param.policyNo.trim() != ''">
			and detail.POLICY_NO like concat('%',replace(replace(#{param.policyNo},'_','\_'),'%','\%'),'%')
		</if>
515 516 517 518 519
		<if test="param.policyStart != null and param.policyStart.trim() != '' and param.policyEnd == null and param.policyEnd.trim() == ''">
			AND detail.POLICY_END   <![CDATA[ >= ]]>  concat(#{param.policyStart}, ' 00:00:00')
		</if>
		<if test="param.policyEnd != null and param.policyEnd.trim() != '' and param.policyStart == null and param.policyStart.trim() == ''">
			AND detail.POLICY_START <![CDATA[ <= ]]> concat(#{param.policyEnd}, ' 23:59:59')
520
		</if>
521 522 523 524 525 526
		<if test="param.policyStart != null and param.policyStart.trim() != '' and param.policyEnd != null and param.policyEnd.trim() != ''">
			and (
			(detail.POLICY_START <![CDATA[ <= ]]>  concat(#{param.policyStart}, ' 00:00:00') and detail.POLICY_END <![CDATA[ >= ]]> concat(#{param.policyEnd}, ' 23:59:59')) OR
			(detail.POLICY_START <![CDATA[ >= ]]>  concat(#{param.policyStart}, ' 00:00:00') and detail.POLICY_START <![CDATA[ <= ]]> concat(#{param.policyEnd}, ' 23:59:59')) OR
			(detail.POLICY_END <![CDATA[ >= ]]>  concat(#{param.policyStart}, ' 00:00:00') and detail.POLICY_END <![CDATA[ <= ]]> concat(#{param.policyEnd}, ' 23:59:59'))
			)
527
		</if>
528
		ORDER BY refund.CREATE_TIME DESC
529
	</select>
530 531
	<!-- 减员办理列表分页查询-->
	<select id="getInsuranceRefundHandlingPageList" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.RefundExportListVo">
李灿灿's avatar
李灿灿 committed
532
		select
533
		DISTINCT
李灿灿's avatar
李灿灿 committed
534
		detail.id as id,
535 536 537 538
		detail.EMP_NAME as empName,
		detail.EMP_IDCARD_NO as empIdcardNo,
		detail.BUY_TYPE as buyType,
		detail.DEPT_NO as deptNo,
539 540 541 542 543
		detail.POST as post,
		detail.INSURANCE_PROVINCE_NAME as insuranceProvinceName,
		detail.INSURANCE_CITY_NAME as insuranceCityName,
		detail.INSURANCE_HANDLE_PROVINCE_NAME as insuranceHandleProvinceName,
		detail.INSURANCE_HANDLE_CITY_NAME as insuranceHandleCityName,
544 545 546 547 548
		detail.POLICY_START as policyStart,
		detail.POLICY_END as policyEnd,
		detail.INSURANCE_COMPANY_NAME as insuranceCompanyName,
		detail.INSURANCE_TYPE_NAME as insuranceTypeName,
		detail.BUY_STANDARD as buyStandard,
549 550
		detail.MEDICAL_QUOTA as medicalQuota,
		detail.DIE_DISABLE_QUOTA as dieDisableQuota,
551
		refund.CREATE_NAME as createName,
552 553
		detail.REDUCE_HANDLE_STATUS as reduceHandleStatus
		from
554 555
			t_insurance_detail detail,
			t_insurance_refund refund
556
		where
557
			detail.ID = refund.INS_DETAIL_ID
558 559 560 561 562 563
		<if test="param.empName != null and param.empName.trim() != ''">
			and detail.EMP_NAME like concat('%',replace(replace(#{param.empName},'_','\_'),'%','\%'),'%')
		</if>
		<if test="param.empIdcardNo != null and param.empIdcardNo.trim() != ''">
			and detail.EMP_IDCARD_NO like concat('%',replace(replace(#{param.empIdcardNo},'_','\_'),'%','\%'),'%')
		</if>
564 565
		<if test="param.deptNo != null and param.deptNo.trim() != ''">
			and detail.DEPT_NO like concat('%',replace(replace(#{param.deptNo},'_','\_'),'%','\%'),'%')
566
		</if>
567 568
		<if test="param.reduceHandleStatus != null">
			and detail.REDUCE_HANDLE_STATUS = #{param.reduceHandleStatus}
569
		</if>
570
		<if test="param.isOverdue != null">
571 572
			and detail.IS_OVERDUE like concat('%',replace(replace(#{param.isOverdue},'_','\_'),'%','\%'),'%')
		</if>
573
		<if test="param.isUse != null">
574 575
			and detail.IS_USE like concat('%',replace(replace(#{param.isUse},'_','\_'),'%','\%'),'%')
		</if>
576
		ORDER BY refund.CREATE_TIME DESC
577
	</select>
578 579
	<!-- 减员办理列表不分页查询-->
	<select id="getInsuranceRefundHandlingList" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.RefundExportListVo">
580
		select
581
		DISTINCT
582 583
		detail.id as id,
		detail.DEPT_NO as deptNo,
李灿灿's avatar
李灿灿 committed
584 585 586 587
		detail.EMP_NAME as empName,
		detail.EMP_IDCARD_NO as empIdcardNo,
		detail.BUY_TYPE as buyType,
		detail.POST as post,
588 589 590 591
		detail.INSURANCE_PROVINCE_NAME as insuranceProvinceName,
		detail.INSURANCE_CITY_NAME as insuranceCityName,
		detail.INSURANCE_HANDLE_PROVINCE_NAME as insuranceHandleProvinceName,
		detail.INSURANCE_HANDLE_CITY_NAME as insuranceHandleCityName,
李灿灿's avatar
李灿灿 committed
592 593 594 595 596
		detail.POLICY_START as policyStart,
		detail.POLICY_END as policyEnd,
		detail.INSURANCE_COMPANY_NAME as insuranceCompanyName,
		detail.INSURANCE_TYPE_NAME as insuranceTypeName,
		detail.BUY_STANDARD as buyStandard,
597 598
		detail.MEDICAL_QUOTA as medicalQuota,
		detail.DIE_DISABLE_QUOTA as dieDisableQuota,
李灿灿's avatar
李灿灿 committed
599
		detail.SETTLE_TYPE as settleType,
600
		detail.SETTLE_MONTH as settleMonth,
601 602 603
		refund.CREATE_NAME as createName,
		detail.REMARK as remark,
		detail.REDUCE_HANDLE_STATUS as reduceHandleStatus
604
		from
605 606
		t_insurance_detail detail,
		t_insurance_refund refund
607 608 609
		where
		detail.DELETE_FLAG = 0
		and
610 611
		detail.ID = refund.INS_DETAIL_ID
		and
612
		detail.REDUCE_HANDLE_STATUS = 1
李灿灿's avatar
李灿灿 committed
613 614 615 616 617 618
		<if test="param.empName != null and param.empName.trim() != ''">
			and detail.EMP_NAME like concat('%',replace(replace(#{param.empName},'_','\_'),'%','\%'),'%')
		</if>
		<if test="param.empIdcardNo != null and param.empIdcardNo.trim() != ''">
			and detail.EMP_IDCARD_NO like concat('%',replace(replace(#{param.empIdcardNo},'_','\_'),'%','\%'),'%')
		</if>
619 620
		<if test="param.deptNo != null and param.deptNo.trim() != ''">
			and detail.DEPT_NO like concat('%',replace(replace(#{param.deptNo},'_','\_'),'%','\%'),'%')
李灿灿's avatar
李灿灿 committed
621
		</if>
622
		<if test="param.isOverdue != null ">
623 624
			and detail.IS_OVERDUE like concat('%',replace(replace(#{param.isOverdue},'_','\_'),'%','\%'),'%')
		</if>
625
		<if test="param.isUse != null">
626 627 628
			and detail.IS_USE like concat('%',replace(replace(#{param.isUse},'_','\_'),'%','\%'),'%')
		</if>
		ORDER BY detail.REFUND_CREATE_TIME DESC
李灿灿's avatar
李灿灿 committed
629
	</select>
630
	<!-- 查询保单列表-->
631 632 633 634 635 636 637 638 639 640 641 642
	<select id="selectDetailListByIds"
			resultType="com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail">
		select
			<include refid="Base_Column_List"></include>
		from
				t_insurance_detail
		where
			ID in
			<foreach collection="param.idList" index="index" item="item" open="(" separator="," close=")">
				#{item}
			</foreach>
	</select>
643
	<!-- 查询保单减员退费信息-->
644
	<select id="selectRefundDetail" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.TInsuranceRefundDetail">
645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672
		select
			detail.DEPT_NO as deptNo,
			detail.EMP_NAME as empName,
			detail.EMP_IDCARD_NO as empIdcardNo,
			refund.ID as id,
			refund.INS_DETAIL_ID as insDetailId,
			refund.REFUND_MONEY as refundMoney
		from
			t_insurance_detail detail,
			t_insurance_refund refund
		where
			detail.DELETE_FLAG = 0
		and
			detail.ID = refund.INS_DETAIL_ID
		and
			detail.BUY_HANDLE_STATUS = 5
		and
			detail.REDUCE_HANDLE_STATUS = 4
		<if test="param.empName != null and param.empName.trim() != ''">
			and detail.EMP_NAME = #{param.empName}
		</if>
		<if test="param.empIdcardNo != null and param.empIdcardNo.trim() != ''">
			and detail.EMP_IDCARD_NO = #{param.empIdcardNo}
		</if>
		<if test="param.policyNo!= null and param.policyNo.trim() != ''">
			and detail.POLICY_NO = #{param.policyNo}
		</if>
	</select>
673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748
	<!-- 已投保列表分页查询-->
	<select id="getRefundExportListBySelect" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.RefundExportListVo">
		select
			detail.id as id,
			detail.DEPT_NO as deptNo,
			detail.EMP_NAME as empName,
			detail.EMP_IDCARD_NO as empIdcardNo,
			detail.BUY_TYPE as buyType,
			detail.POST as post,
			detail.INSURANCE_PROVINCE_NAME as insuranceProvinceName,
			detail.INSURANCE_CITY_NAME as insuranceCityName,
			detail.INSURANCE_HANDLE_PROVINCE_NAME as insuranceHandleProvinceName,
			detail.INSURANCE_HANDLE_CITY_NAME as insuranceHandleCityName,
			detail.POLICY_START as policyStart,
			detail.POLICY_END as policyEnd,
			detail.INSURANCE_COMPANY_NAME as insuranceCompanyName,
			detail.INSURANCE_TYPE_NAME as insuranceTypeName,
			detail.BUY_STANDARD as buyStandard,
			detail.MEDICAL_QUOTA as medicalQuota,
			detail.DIE_DISABLE_QUOTA as dieDisableQuota,
			detail.SETTLE_MONTH as settleMonth,
			detail.SETTLE_TYPE as settleType,
			detail.CREATE_NAME as createName,
			detail.REMARK as remark
		from
		    t_insurance_detail detail
		where
		    detail.id in
		<foreach collection="idList" index="index" item="item" open="(" separator="," close=")">
			#{item}
		</foreach>
		ORDER BY detail.CREATE_TIME DESC
	</select>
	<!-- 已投保列表分页查询-->
	<select id="getRefundExportList" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.RefundExportListVo">
		select
		    detail.id as id,
			detail.DEPT_NO as deptNo,
			detail.EMP_NAME as empName,
			detail.EMP_IDCARD_NO as empIdcardNo,
			detail.BUY_TYPE as buyType,
			detail.POST as post,
			detail.INSURANCE_PROVINCE_NAME as insuranceProvinceName,
			detail.INSURANCE_CITY_NAME as insuranceCityName,
			detail.INSURANCE_HANDLE_PROVINCE_NAME as insuranceHandleProvinceName,
			detail.INSURANCE_HANDLE_CITY_NAME as insuranceHandleCityName,
			detail.POLICY_START as policyStart,
			detail.POLICY_END as policyEnd,
			detail.INSURANCE_COMPANY_NAME as insuranceCompanyName,
			detail.INSURANCE_TYPE_NAME as insuranceTypeName,
			detail.BUY_STANDARD as buyStandard,
			detail.MEDICAL_QUOTA as medicalQuota,
			detail.DIE_DISABLE_QUOTA as dieDisableQuota,
			detail.SETTLE_MONTH as settleMonth,
			detail.SETTLE_TYPE as settleType,
			detail.CREATE_NAME as createName,
			detail.REMARK as remark
		from
			t_insurance_detail detail
		where
		    detail.DELETE_FLAG = 0 and detail.REDUCE_HANDLE_STATUS = 1
		<if test="param.empName != null and param.empName.trim() != ''">
			and detail.EMP_NAME like concat('%',replace(replace(#{param.empName},'_','\_'),'%','\%'),'%')
		</if>
		<if test="param.empIdcardNo != null and param.empIdcardNo.trim() != ''">
			and detail.EMP_IDCARD_NO like concat('%',replace(replace(#{param.empIdcardNo},'_','\_'),'%','\%'),'%')
		</if>
		<if test="param.deptNo != null and param.deptNo.trim() != ''">
			and detail.DEPT_NO like concat('%',replace(replace(#{param.deptNo},'_','\_'),'%','\%'),'%')
		</if>
		<if test="param.insuranceCompanyName != null and param.insuranceCompanyName.trim() != ''">
			and detail.INSURANCE_COMPANY_NAME like concat('%',replace(replace(#{param.insuranceCompanyName},'_','\_'),'%','\%'),'%')
		</if>
		ORDER BY detail.CREATE_TIME DESC
	</select>
	<!-- 已投保列表分页查询-->
749 750 751 752 753 754 755 756
	<update id="updateInsuranceRefund">
		update
			t_insurance_detail detail
		set
			UPDATE_BY = #{param.updateBy},
			REDUCE_HANDLE_STATUS = #{param.refundType},
			UPDATE_TIME = #{param.refundCreateTime}
		where
757
		      detail.ID in
758 759 760 761
		<foreach collection="param.idList" index="index" item="item" open="(" separator="," close=")">
			#{item}
		</foreach>
	</update>
762
</mapper>