TInsuranceDetailMapper.xml 27.9 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 38
            <result property="actualPremium" column="ACTUAL_PREMIUM" jdbcType="DECIMAL"/>
            <result property="estimatePremium" column="ESTIMATE_PREMIUM" jdbcType="DECIMAL"/>
            <result property="buyHandleStatus" column="BUY_HANDLE_STATUS" jdbcType="TINYINT"/>
李灿灿's avatar
李灿灿 committed
39
            <result property="defaultSettleId" column="DEFAULT_SETTLE_ID" jdbcType="VARCHAR"/>
40 41 42 43
            <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
44
            <result property="remark" column="REMARK" jdbcType="VARCHAR"/>
45 46 47 48 49 50 51 52 53
            <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
54
        ID,EMP_NAME,
李灿灿's avatar
李灿灿 committed
55
        EMP_IDCARD_NO,DEPT_NO,POST,INSURANCE_COMPANY_NAME,INSURANCE_TYPE_NAME,
李灿灿's avatar
李灿灿 committed
56
        INSURANCE_TYPE_ID,BUY_STANDARD,MEDICAL_QUOTA,DIE_DISABLE_QUOTA,POLICY_NO,
57 58
        POLICY_START,POLICY_END,POLICY_EFFECT,
        BATCH_DATE,SETTLE_MONTH,INVOICE_NO,
李灿灿's avatar
李灿灿 committed
59 60
        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,
李灿灿's avatar
李灿灿 committed
61
        ACTUAL_PREMIUM,ESTIMATE_PREMIUM,
李灿灿's avatar
李灿灿 committed
62
        BUY_HANDLE_STATUS,DEFAULT_SETTLE_ID,REDUCE_HANDLE_STATUS,
李灿灿's avatar
李灿灿 committed
63
        IS_USE,IS_EFFECT,IS_OVERDUE,REMARK,
64 65 66
        CREATE_BY,CREATE_NAME,CREATE_TIME,
        UPDATE_BY,UPDATE_TIME,DELETE_FLAG
    </sql>
李灿灿's avatar
李灿灿 committed
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
	<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
82 83 84 85
		detail.SETTLE_MONTH as settleMonth
		from t_insurance_detail detail
		where detail.DELETE_FLAG = 0
		<if test="param.deptNo != null and param.deptNo.trim() != ''">
86
			and detail.DEPT_NO like concat('%',replace(replace(#{param.deptNo},'_','\_'),'%','\%'),'%')
李灿灿's avatar
李灿灿 committed
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
		</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>
		ORDER BY detail.CREATE_TIME DESC
	</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
118 119 120 121
		detail.SETTLE_MONTH as settleMonth
		from t_insurance_detail detail
		where detail.DELETE_FLAG = 0
		<if test="param.deptNo != null and param.deptNo.trim() != ''">
122
			and detail.DEPT_NO like concat('%',replace(replace(#{param.deptNo},'_','\_'),'%','\%'),'%')
李灿灿's avatar
李灿灿 committed
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
		</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>
		ORDER BY detail.CREATE_TIME DESC
	</select>
李灿灿's avatar
李灿灿 committed
138 139 140

	<select id="getInsuranceDetailById" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceDetailVO">
		select
李灿灿's avatar
李灿灿 committed
141
		detail.id as id,
李灿灿's avatar
李灿灿 committed
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
		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,
		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
164
		tis.SETTLE_HANDLE_STATUS as settleHandleStatus,
李灿灿's avatar
李灿灿 committed
165 166 167 168
		detail.IS_USE as isUse,
		detail.IS_EFFECT as isEffect,
		detail.IS_OVERDUE as isOverdue,
		detail.INSURANCE_PROVINCE_NAME as insuranceProvinceName,
李灿灿's avatar
李灿灿 committed
169
		detail.INSURANCE_PROVINCE as insuranceProvince,
李灿灿's avatar
李灿灿 committed
170
		detail.INSURANCE_CITY_NAME as insuranceCityName,
李灿灿's avatar
李灿灿 committed
171
		detail.INSURANCE_CITY as insuranceCity,
李灿灿's avatar
李灿灿 committed
172
		detail.INSURANCE_HANDLE_PROVINCE_NAME as insuranceHandleProvinceName,
李灿灿's avatar
李灿灿 committed
173
		detail.INSURANCE_HANDLE_PROVINCE as insuranceHandleProvince,
李灿灿's avatar
李灿灿 committed
174
		detail.INSURANCE_HANDLE_CITY_NAME as insuranceHandleCityName,
李灿灿's avatar
李灿灿 committed
175
		detail.INSURANCE_HANDLE_CITY as insuranceHandleCity,
李灿灿's avatar
李灿灿 committed
176 177 178
		detail.CREATE_NAME as createName,
		detail.CREATE_TIME as createTime
		from t_insurance_detail detail
李灿灿's avatar
李灿灿 committed
179
		left join t_insurance_settle tis on detail.DEFAULT_SETTLE_ID = tis.ID
李灿灿's avatar
李灿灿 committed
180 181
		where detail.ID = #{id}
	</select>
李灿灿's avatar
李灿灿 committed
182

李灿灿's avatar
李灿灿 committed
183 184 185
	<select id="getInsuranceExportListBySelect" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceExportListVO">
		select detail.id as id,
		detail.DEPT_NO as deptNo,
186 187 188 189
		detail.EMP_NAME as empName,
		detail.EMP_IDCARD_NO as empIdcardNo,
		detail.BUY_TYPE as buyType,
		detail.POST as post,
李灿灿's avatar
李灿灿 committed
190 191 192 193
		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,
194 195 196 197 198
		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
199 200 201
		detail.MEDICAL_QUOTA as medicalQuota,
		detail.DIE_DISABLE_QUOTA as dieDisableQuota,
		detail.SETTLE_MONTH as settleMonth,
202
		detail.SETTLE_TYPE as settleType,
李灿灿's avatar
李灿灿 committed
203 204
		detail.CREATE_NAME as createName,
		detail.REMARK as remark
205
		from t_insurance_detail detail
李灿灿's avatar
李灿灿 committed
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236
		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
237 238 239 240 241 242
		<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
243
		<if test="param.deptNo != null and param.deptNo.trim() != ''">
244
			and detail.DEPT_NO like concat('%',replace(replace(#{param.deptNo},'_','\_'),'%','\%'),'%')
李灿灿's avatar
李灿灿 committed
245
		</if>
246 247 248 249 250
		<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
251 252 253

	<!-- ***********************减员办理******************************** -->
	<select id="getInsuredListPage" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuredListVo">
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268
		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,
			detail.INSURANCE_COMPANY_NAME as insuranceCompanyName,
			detail.INSURANCE_TYPE_NAME as insuranceTypeName,
			detail.BUY_STANDARD as buyStandard
269 270
		from
		     t_insurance_detail detail
271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 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 391
		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>
		<if test="param.policyStart != null and param.policyStart.trim() != ''">
			AND detail.POLICY_START >= concat(#{param.policyStart}, ' 00:00:00')
		</if>
		<if test="param.policyEnd != null and param.policyEnd.trim() != ''">
			AND detail.POLICY_END <![CDATA[ <= ]]> concat(#{param.policyEnd}, ' 23:59:59')
		</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>
		<if test="param.isOverdue != null and param.isOverdue.trim() != ''">
			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>

	<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>
		<if test="param.policyStart != null and param.policyStart.trim() != ''">
			AND detail.POLICY_START >= concat(#{param.policyStart}, ' 00:00:00')
		</if>
		<if test="param.policyEnd != null and param.policyEnd.trim() != ''">
			AND detail.POLICY_END <![CDATA[ <= ]]> concat(#{param.policyEnd}, ' 23:59:59')
		</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>
		<if test="param.isOverdue != null and param.isOverdue.trim() != ''">
			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>
	<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,
392
			refund.CREATE_TIME as refundCreateTime
393
		from
394 395
			t_insurance_detail detail,
			t_insurance_refund refund
396 397
		where
		    detail.DELETE_FLAG = 0
398 399
		and
			detail.ID = refund.INS_DETAIL_ID
400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422
		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>
		<if test="param.policyStart != null and param.policyStart.trim() != ''">
			AND detail.POLICY_START >= concat(#{param.policyStart}, ' 00:00:00')
		</if>
		<if test="param.policyEnd != null and param.policyEnd.trim() != ''">
			AND detail.POLICY_END <![CDATA[ <= ]]> concat(#{param.policyEnd}, ' 23:59:59')
		</if>
423
		ORDER BY refund.CREATE_TIME DESC
424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443
	</select>
	<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,
444
			refund.CREATE_TIME as refundCreateTime
445
		from
446 447
			t_insurance_detail detail,
			t_insurance_refund refund
448
		where
449 450
			detail.ID = refund.INS_DETAIL_ID
		and
451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474
			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>
		<if test="param.policyStart != null and param.policyStart.trim() != ''">
			AND detail.POLICY_START >= concat(#{param.policyStart}, ' 00:00:00')
		</if>
		<if test="param.policyEnd != null and param.policyEnd.trim() != ''">
			AND detail.POLICY_END <![CDATA[ <= ]]> concat(#{param.policyEnd}, ' 23:59:59')
		</if>
475
		ORDER BY refund.CREATE_TIME DESC
476 477
	</select>
	<select id="getInsuranceRefundHandlingPageList" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceRefundHandlingListVo">
李灿灿's avatar
李灿灿 committed
478 479
		select
		detail.id as id,
480 481 482 483
		detail.EMP_NAME as empName,
		detail.EMP_IDCARD_NO as empIdcardNo,
		detail.BUY_TYPE as buyType,
		detail.DEPT_NO as deptNo,
484 485 486 487 488
		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,
489 490 491 492 493
		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,
494 495
		detail.MEDICAL_QUOTA as medicalQuota,
		detail.DIE_DISABLE_QUOTA as dieDisableQuota,
496
		detail.CREATE_NAME as createName,
497 498
		detail.REDUCE_HANDLE_STATUS as reduceHandleStatus
		from
499 500
			t_insurance_detail detail,
			t_insurance_refund refund
501
		where
502
			detail.ID = refund.INS_DETAIL_ID
503 504
		and
			(detail.REDUCE_HANDLE_STATUS is not null and detail.REDUCE_HANDLE_STATUS != 3)
505 506 507 508 509 510
		<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>
511 512
		<if test="param.deptNo != null and param.deptNo.trim() != ''">
			and detail.DEPT_NO like concat('%',replace(replace(#{param.deptNo},'_','\_'),'%','\%'),'%')
513
		</if>
514 515 516 517 518 519 520 521 522
		<if test="param.reduceHandleStatus != null and param.reduceHandleStatus.trim() != ''">
			and detail.REDUCE_HANDLE_STATUS like concat('%',replace(replace(#{param.reduceHandleStatus},'_','\_'),'%','\%'),'%')
		</if>
		<if test="param.isOverdue != null and param.isOverdue.trim() != ''">
			and detail.IS_OVERDUE like concat('%',replace(replace(#{param.isOverdue},'_','\_'),'%','\%'),'%')
		</if>
		<if test="param.isUse != null and param.isUse.trim() != ''">
			and detail.IS_USE like concat('%',replace(replace(#{param.isUse},'_','\_'),'%','\%'),'%')
		</if>
523
		ORDER BY refund.CREATE_TIME DESC
524
	</select>
525 526 527 528
	<select id="getInsuranceRefundHandlingList" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceRefundHandlingListVo">
		select
		detail.id as id,
		detail.DEPT_NO as deptNo,
李灿灿's avatar
李灿灿 committed
529 530 531 532
		detail.EMP_NAME as empName,
		detail.EMP_IDCARD_NO as empIdcardNo,
		detail.BUY_TYPE as buyType,
		detail.POST as post,
533 534 535 536
		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
537 538 539 540 541
		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,
542 543
		detail.MEDICAL_QUOTA as medicalQuota,
		detail.DIE_DISABLE_QUOTA as dieDisableQuota,
李灿灿's avatar
李灿灿 committed
544
		detail.SETTLE_TYPE as settleType,
545 546 547 548 549 550 551 552 553
		detail.SETTLE_MONTH as settleMonth,
		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
李灿灿's avatar
李灿灿 committed
554 555 556 557 558 559
		<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>
560 561
		<if test="param.deptNo != null and param.deptNo.trim() != ''">
			and detail.DEPT_NO like concat('%',replace(replace(#{param.deptNo},'_','\_'),'%','\%'),'%')
李灿灿's avatar
李灿灿 committed
562
		</if>
563 564 565 566 567 568 569 570 571 572
		<if test="param.reduceHandleStatus != null and param.reduceHandleStatus.trim() != ''">
			and detail.REDUCE_HANDLE_STATUS like concat('%',replace(replace(#{param.reduceHandleStatus},'_','\_'),'%','\%'),'%')
		</if>
		<if test="param.isOverdue != null and param.isOverdue.trim() != ''">
			and detail.IS_OVERDUE like concat('%',replace(replace(#{param.isOverdue},'_','\_'),'%','\%'),'%')
		</if>
		<if test="param.isUse != null and param.isUse.trim() != ''">
			and detail.IS_USE like concat('%',replace(replace(#{param.isUse},'_','\_'),'%','\%'),'%')
		</if>
		ORDER BY detail.REFUND_CREATE_TIME DESC
李灿灿's avatar
李灿灿 committed
573 574
	</select>

575 576 577 578 579 580 581 582 583 584 585 586 587
	<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>

588 589 590 591 592 593 594 595
	<update id="updateInsuranceRefund">
		update
			t_insurance_detail detail
		set
			UPDATE_BY = #{param.updateBy},
			REDUCE_HANDLE_STATUS = #{param.refundType},
			UPDATE_TIME = #{param.refundCreateTime}
		where
596
		      detail.ID in
597 598 599 600
		<foreach collection="param.idList" index="index" item="item" open="(" separator="," close=")">
			#{item}
		</foreach>
	</update>
601 602


603
</mapper>