TSocialInfoMapper.xml 39.5 KB
Newer Older
fangxinjiang's avatar
fangxinjiang committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
<?xml version="1.0" encoding="UTF-8"?>

<!--
  ~
  ~      Copyright (c) 2018-2025, lengleng All rights reserved.
  ~
  ~  Redistribution and use in source and binary forms, with or without
  ~  modification, are permitted provided that the following conditions are met:
  ~
  ~ Redistributions of source code must retain the above copyright notice,
  ~  this list of conditions and the following disclaimer.
  ~  Redistributions in binary form must reproduce the above copyright
  ~  notice, this list of conditions and the following disclaimer in the
  ~  documentation and/or other materials provided with the distribution.
  ~  Neither the name of the yifu4cloud.com developer nor the names of its
  ~  contributors may be used to endorse or promote products derived from
  ~  this software without specific prior written permission.
  ~  Author: lengleng (wangiegie@gmail.com)
  ~
  -->

<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

fangxinjiang's avatar
fangxinjiang committed
24
<mapper namespace="com.yifu.cloud.plus.v1.yifu.social.mapper.TSocialInfoMapper">
fangxinjiang's avatar
fangxinjiang committed
25

fangxinjiang's avatar
fangxinjiang committed
26
  <resultMap id="tSocialInfoMap" type="com.yifu.cloud.plus.v1.yifu.social.entity.TSocialInfo">
fangxinjiang's avatar
fangxinjiang committed
27 28
    <id property="id" column="ID"/>
    <result property="socialHousehold" column="SOCIAL_HOUSEHOLD"/>
fangxinjiang's avatar
fangxinjiang committed
29
	  <result property="socialHouseholdName" column="SOCIAL_HOUSEHOLD_NAME"/>
fangxinjiang's avatar
fangxinjiang committed
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
    <result property="socialStartDate" column="SOCIAL_START_DATE"/>
    <result property="unitPensionCardinal" column="UNIT_PENSION_CARDINAL"/>
    <result property="unitMedicalCardinal" column="UNIT_MEDICAL_CARDINAL"/>
    <result property="unitUnemploymentCardinal" column="UNIT_UNEMPLOYMENT_CARDINAL"/>
    <result property="unitBigailmentCardinal" column="UNIT_BIGAILMENT_CARDINAL"/>
    <result property="unitWorkInjuryCardinal" column="UNIT_WORK_INJURY_CARDINAL"/>
    <result property="unitBirthCardinal" column="UNIT_BIRTH_CARDINAL"/>
    <result property="personalPensionCardinal" column="PERSONAL_PENSION_CARDINAL"/>
    <result property="personalMedicalCardinal" column="PERSONAL_MEDICAL_CARDINAL"/>
    <result property="personalBigailmentCardinal" column="PERSONAL_BIGAILMENT_CARDINAL"/>
    <result property="personalUnemploymentCardinal" column="PERSONAL_UNEMPLOYMENT_CARDINAL"/>
    <result property="empId" column="EMP_ID"/>
    <result property="empNo" column="EMP_NO"/>
    <result property="empName" column="EMP_NAME"/>
    <result property="empIdcard" column="EMP_IDCARD"/>
    <result property="unitPensionPer" column="UNIT_PENSION_PER"/>
    <result property="unitMedicalPer" column="UNIT_MEDICAL_PER"/>
    <result property="unitUnemploymentPer" column="UNIT_UNEMPLOYMENT_PER"/>
    <result property="unitWorkUnjuryPer" column="UNIT_WORK_UNJURY_PER"/>
    <result property="unitBirthPer" column="UNIT_BIRTH_PER"/>
    <result property="personalPensionPer" column="PERSONAL_PENSION_PER"/>
    <result property="personalMedicalPer" column="PERSONAL_MEDICAL_PER"/>
    <result property="personalUnemploymentPer" column="PERSONAL_UNEMPLOYMENT_PER"/>
    <result property="auditStatus" column="AUDIT_STATUS"/>
    <result property="handleStatus" column="HANDLE_STATUS"/>
    <result property="draftStatus" column="DRAFT_STATUS"/>
56
    <result property="cardinalId" column="CARDINAL_ID"/>
fangxinjiang's avatar
fangxinjiang committed
57 58
    <result property="oldId" column="OLD_ID"/>
    <result property="settleDomain" column="SETTLE_DOMAIN"/>
huyuchen's avatar
huyuchen committed
59
    <result property="settleDomainCode" column="SETTLE_DOMAIN_CODE"/>
fangxinjiang's avatar
fangxinjiang committed
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
    <result property="socialProvince" column="SOCIAL_PROVINCE"/>
    <result property="socialCity" column="SOCIAL_CITY"/>
    <result property="socialTown" column="SOCIAL_TOWN"/>
    <result property="remark" column="REMARK"/>
    <result property="deleteFlag" column="DELETE_FLAG"/>
    <result property="unitPersionMoney" column="UNIT_PERSION_MONEY"/>
    <result property="unitMedicalMoney" column="UNIT_MEDICAL_MONEY"/>
    <result property="unitUnemploymentMoney" column="UNIT_UNEMPLOYMENT_MONEY"/>
    <result property="unitInjuryMoney" column="UNIT_INJURY_MONEY"/>
    <result property="unitBirthMoney" column="UNIT_BIRTH_MONEY"/>
    <result property="unitBigailmentMoney" column="UNIT_BIGAILMENT_MONEY"/>
    <result property="personalPersionMoney" column="PERSONAL_PERSION_MONEY"/>
    <result property="personalMedicalMoney" column="PERSONAL_MEDICAL_MONEY"/>
    <result property="personalUnemploymentMoney" column="PERSONAL_UNEMPLOYMENT_MONEY"/>
    <result property="personalBigailmentMoney" column="PERSONAL_BIGAILMENT_MONEY"/>
    <result property="valueType" column="VALUE_TYPE"/>
    <result property="personalBigailmentPer" column="PERSONAL_BIGAILMENT_PER"/>
    <result property="unitBigailmentPer" column="UNIT_BIGAILMENT_PER"/>
    <result property="isIllness" column="IS_ILLNESS"/>
    <result property="collectMoth" column="COLLECT_MOTH"/>
    <result property="collectType" column="COLLECT_TYPE"/>
    <result property="processInstId" column="PROCESS_INST_ID"/>
    <result property="auditUser" column="AUDIT_USER"/>
83
	  <result property="auditUserName" column="AUDIT_USER_NAME"/>
fangxinjiang's avatar
fangxinjiang committed
84 85
    <result property="auditTime" column="AUDIT_TIME"/>
    <result property="handleUser" column="HANDLE_USER"/>
86
	  <result property="handleUserName" column="HANDLE_USER_NAME"/>
fangxinjiang's avatar
fangxinjiang 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
    <result property="handleTime" column="HANDLE_TIME"/>
    <result property="belongUnit" column="BELONG_UNIT"/>
    <result property="socialReduceDate" column="SOCIAL_REDUCE_DATE"/>
    <result property="canOverpay" column="CAN_OVERPAY"/>
    <result property="overpayNumber" column="OVERPAY_NUMBER"/>
    <result property="haveThisMonth" column="HAVE_THIS_MONTH"/>
    <result property="insurancePension" column="INSURANCE_PENSION"/>
    <result property="insuranceMedical" column="INSURANCE_MEDICAL"/>
    <result property="insuranceUnemployment" column="INSURANCE_UNEMPLOYMENT"/>
    <result property="insuranceInjury" column="INSURANCE_INJURY"/>
    <result property="insuranceBirth" column="INSURANCE_BIRTH"/>
    <result property="insuranceBigailment" column="INSURANCE_BIGAILMENT"/>
    <result property="insuranceIsLatestCardinality" column="INSURANCE_IS_LATEST_CARDINALITY"/>
    <result property="reduceHandleUser" column="REDUCE_HANDLE_USER"/>
    <result property="reduceHandleTime" column="REDUCE_HANDLE_TIME"/>
    <result property="isChargePersonal" column="IS_CHARGE_PERSONAL"/>
    <result property="trustRemark" column="TRUST_REMARK"/>
    <result property="reduceCan" column="REDUCE_CAN"/>
    <result property="inauguralTeam" column="INAUGURAL_TEAM"/>
    <result property="telecomNumber" column="TELECOM_NUMBER"/>
    <result property="paymentType" column="PAYMENT_TYPE"/>
    <result property="recordBase" column="RECORD_BASE"/>
    <result property="socialType" column="SOCIAL_TYPE"/>
    <result property="pensionStart" column="PENSION_START"/>
    <result property="medicalStart" column="MEDICAL_START"/>
    <result property="unemployStart" column="UNEMPLOY_START"/>
    <result property="workInjuryStart" column="WORK_INJURY_START"/>
    <result property="birthStart" column="BIRTH_START"/>
    <result property="bigailmentStart" column="BIGAILMENT_START"/>
fangxinjiang's avatar
fangxinjiang committed
116 117 118 119 120 121
	<result property="pensionReduceStart" column="PENSION_REDUCE_START"/>
	<result property="medicalReduceStart" column="MEDICAL_REDUCE_START"/>
	<result property="unemployReduceStart" column="UNEMPLOY_REDUCE_START"/>
	<result property="workInjuryReduceStart" column="WORK_INJURY_REDUCE_START"/>
	<result property="birthReduceStart" column="BIRTH_REDUCE_START"/>
	<result property="bigailmentReduceStart" column="BIGAILMENT_REDUCE_START"/>
fangxinjiang's avatar
fangxinjiang committed
122 123 124 125 126 127 128 129 130 131
    <result property="pensionHandle" column="PENSION_HANDLE"/>
    <result property="medicalHandle" column="MEDICAL_HANDLE"/>
    <result property="unemployHandle" column="UNEMPLOY_HANDLE"/>
    <result property="workInjuryHandle" column="WORK_INJURY_HANDLE"/>
    <result property="birthHandle" column="BIRTH_HANDLE"/>
    <result property="bigailmentHandle" column="BIGAILMENT_HANDLE"/>
    <result property="createBy" column="CREATE_BY"/>
    <result property="updateBy" column="UPDATE_BY"/>
    <result property="createName" column="CREATE_NAME"/>
    <result property="updateTime" column="UPDATE_TIME"/>
fangxinjiang's avatar
fangxinjiang committed
132
	<result property="payPolicy" column="PAY_POLICY"/>
fangxinjiang's avatar
fangxinjiang committed
133 134
	<result property="lowerLimit" column="LOWER_LIMIT"/>
	<result property="upperLimit" column="UPPER_LIMIT"/>
fangxinjiang's avatar
fangxinjiang committed
135 136
	<result property="unitSocialSum" column="UNIT_SOCIAL_SUM"/>
	<result property="personalSocialSum" column="PERSONAL_SOCIAL_SUM"/>
137 138

	  <result property="firstPayTime" column="FIRST_PAY_TIME"/>
139 140 141 142 143 144 145 146

	  <!-- 社保士兵新增字段: -->
	  <result property="ygsHandleStatus" column="YGS_HANDLE_STATUS"/>
	  <result property="ysdHandleStatus" column="YSD_HANDLE_STATUS"/>
	  <result property="ygsRemark" column="YGS_REMARK"/>
	  <result property="ysdRemark" column="YSD_REMARK"/>
	  <result property="ygsRemarkOld" column="YGS_REMARK_OLD"/>
	  <result property="ysdRemarkOld" column="YSD_REMARK_OLD"/>
147 148 149
	  <result property="ygsAddId" column="YGS_ADD_ID"/>
	  <result property="ysdAddId" column="YSD_ADD_ID"/>
	  <result property="dispatchId" column="DISPATCH_ID"/>
150
	  <result property="dispatchType" column="DISPATCH_TYPE"/>
151 152
	  <result property="ygsOverDueFlag" column="YGS_OVER_DUE_FLAG"/>
	  <result property="ysdOverDueFlag" column="YSD_OVER_DUE_FLAG"/>
153 154 155 156

	  <!-- 税友新增字段-->
	  <result property="ygsRequestId" column="YGS_REQUEST_ID"/>
	  <result property="ysdRequestId" column="YSD_REQUEST_ID"/>
fangxinjiang's avatar
fangxinjiang committed
157 158 159 160
  </resultMap>
    <sql id="Base_Column_List">
                a.ID,
                a.SOCIAL_HOUSEHOLD,
fangxinjiang's avatar
fangxinjiang committed
161
				a.SOCIAL_HOUSEHOLD_NAME,
fangxinjiang's avatar
fangxinjiang committed
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 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 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255
                a.SOCIAL_START_DATE,
                a.UNIT_PENSION_CARDINAL,
                a.UNIT_MEDICAL_CARDINAL,
                a.UNIT_UNEMPLOYMENT_CARDINAL,
                a.UNIT_BIGAILMENT_CARDINAL,
                a.UNIT_WORK_INJURY_CARDINAL,
                a.UNIT_BIRTH_CARDINAL,
                a.PERSONAL_PENSION_CARDINAL,
                a.PERSONAL_MEDICAL_CARDINAL,
                a.PERSONAL_BIGAILMENT_CARDINAL,
                a.PERSONAL_UNEMPLOYMENT_CARDINAL,
                a.PERSONAL_WORK_INJURY_CARDINAL,
                a.EMP_ID,
                a.EMP_NO,
                a.EMP_NAME,
                a.EMP_IDCARD,
                a.UNIT_PENSION_PER,
                a.UNIT_MEDICAL_PER,
                a.UNIT_UNEMPLOYMENT_PER,
                a.UNIT_WORK_UNJURY_PER,
                a.UNIT_BIRTH_PER,
                a.PERSONAL_PENSION_PER,
                a.PERSONAL_MEDICAL_PER,
                a.PERSONAL_UNEMPLOYMENT_PER,
                a.AUDIT_STATUS,
                a.HANDLE_STATUS,
                a.DRAFT_STATUS,
                a.CARDINAL_IID,
                a.OLD_ID,
                a.SETTLE_DOMAIN,
                a.SOCIAL_PROVINCE,
                a.SOCIAL_CITY,
                a.SOCIAL_TOWN,
                a.REMARK,
                a.DELETE_FLAG,
                a.UNIT_PERSION_MONEY,
                a.UNIT_MEDICAL_MONEY,
                a.UNIT_UNEMPLOYMENT_MONEY,
                a.UNIT_INJURY_MONEY,
                a.UNIT_BIRTH_MONEY,
                a.UNIT_BIGAILMENT_MONEY,
                a.PERSONAL_PERSION_MONEY,
                a.PERSONAL_MEDICAL_MONEY,
                a.PERSONAL_UNEMPLOYMENT_MONEY,
                a.PERSONAL_BIGAILMENT_MONEY,
                a.VALUE_TYPE,
                a.PERSONAL_BIGAILMENT_PER,
                a.UNIT_BIGAILMENT_PER,
                a.IS_ILLNESS,
                a.COLLECT_MOTH,
                a.COLLECT_TYPE,
                a.PROCESS_INST_ID,
                a.AUDIT_USER,
                a.AUDIT_TIME,
                a.HANDLE_USER,
                a.HANDLE_TIME,
                a.BELONG_UNIT,
                a.SOCIAL_REDUCE_DATE,
                a.CAN_OVERPAY,
                a.OVERPAY_NUMBER,
                a.HAVE_THIS_MONTH,
                a.INSURANCE_PENSION,
                a.INSURANCE_MEDICAL,
                a.INSURANCE_UNEMPLOYMENT,
                a.INSURANCE_INJURY,
                a.INSURANCE_BIRTH,
                a.INSURANCE_BIGAILMENT,
                a.INSURANCE_IS_LATEST_CARDINALITY,
                a.REDUCE_HANDLE_USER,
                a.REDUCE_HANDLE_TIME,
                a.IS_CHARGE_PERSONAL,
                a.TRUST_REMARK,
                a.REDUCE_CAN,
                a.INAUGURAL_TEAM,
                a.TELECOM_NUMBER,
                a.PAYMENT_TYPE,
                a.RECORD_BASE,
                a.SOCIAL_TYPE,
                a.BIGAILMENT_VARY_FLAG,
                a.PENSION_START,
                a.MEDICAL_START,
                a.UNEMPLOY_START,
                a.WORK_INJURY_START,
                a.BIRTH_START,
                a.BIGAILMENT_START,
                a.PENSION_HANDLE,
                a.MEDICAL_HANDLE,
                a.UNEMPLOY_HANDLE,
                a.WORK_INJURY_HANDLE,
                a.BIRTH_HANDLE,
                a.BIGAILMENT_HANDLE,
                a.CREATE_BY,
                a.UPDATE_BY,
                a.CREATE_NAME,
fangxinjiang's avatar
fangxinjiang committed
256
                a.UPDATE_TIME,
fangxinjiang's avatar
fangxinjiang committed
257 258
				a.PAY_POLICY,
				a.LOWER_LIMIT,
259
				a.UPPER_LIMIT,a.UNIT_SOCIAL_SUM,a.PERSONAL_SOCIAL_SUM,
260 261 262 263 264 265 266
				a.FIRST_PAY_TIME,

				a.YGS_HANDLE_STATUS,
				a.YSD_HANDLE_STATUS,
				a.YGS_REMARK,
				a.YSD_REMARK,
				a.YGS_REMARK_OLD,
267 268
				a.YSD_REMARK_OLD,
				a.YGS_ADD_ID,
269 270 271
				a.YSD_ADD_ID,
				a.YGS_REQUEST_ID,
				a.YSD_REQUEST_ID
272

fangxinjiang's avatar
fangxinjiang committed
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
    </sql>
    <sql id="tSocialInfo_where">
        <if test="tSocialInfo != null">
                    <if test="tSocialInfo.id != null and tSocialInfo.id.trim() != ''">
                        AND a.ID = #{tSocialInfo.id}
                    </if>
                    <if test="tSocialInfo.socialHousehold != null and tSocialInfo.socialHousehold.trim() != ''">
                        AND a.SOCIAL_HOUSEHOLD = #{tSocialInfo.socialHousehold}
                    </if>
                    <if test="tSocialInfo.socialStartDate != null">
                        AND a.SOCIAL_START_DATE = #{tSocialInfo.socialStartDate}
                    </if>
                    <if test="tSocialInfo.unitPensionCardinal != null">
                        AND a.UNIT_PENSION_CARDINAL = #{tSocialInfo.unitPensionCardinal}
                    </if>
                    <if test="tSocialInfo.unitMedicalCardinal != null">
                        AND a.UNIT_MEDICAL_CARDINAL = #{tSocialInfo.unitMedicalCardinal}
                    </if>
                    <if test="tSocialInfo.unitUnemploymentCardinal != null">
                        AND a.UNIT_UNEMPLOYMENT_CARDINAL = #{tSocialInfo.unitUnemploymentCardinal}
                    </if>
                    <if test="tSocialInfo.unitBigailmentCardinal != null">
                        AND a.UNIT_BIGAILMENT_CARDINAL = #{tSocialInfo.unitBigailmentCardinal}
                    </if>
                    <if test="tSocialInfo.unitWorkInjuryCardinal != null">
                        AND a.UNIT_WORK_INJURY_CARDINAL = #{tSocialInfo.unitWorkInjuryCardinal}
                    </if>
                    <if test="tSocialInfo.unitBirthCardinal != null">
                        AND a.UNIT_BIRTH_CARDINAL = #{tSocialInfo.unitBirthCardinal}
                    </if>
                    <if test="tSocialInfo.personalPensionCardinal != null">
                        AND a.PERSONAL_PENSION_CARDINAL = #{tSocialInfo.personalPensionCardinal}
                    </if>
                    <if test="tSocialInfo.personalMedicalCardinal != null">
                        AND a.PERSONAL_MEDICAL_CARDINAL = #{tSocialInfo.personalMedicalCardinal}
                    </if>
                    <if test="tSocialInfo.personalBigailmentCardinal != null">
                        AND a.PERSONAL_BIGAILMENT_CARDINAL = #{tSocialInfo.personalBigailmentCardinal}
                    </if>
                    <if test="tSocialInfo.personalUnemploymentCardinal != null">
                        AND a.PERSONAL_UNEMPLOYMENT_CARDINAL = #{tSocialInfo.personalUnemploymentCardinal}
                    </if>
                    <if test="tSocialInfo.personalWorkInjuryCardinal != null">
                        AND a.PERSONAL_WORK_INJURY_CARDINAL = #{tSocialInfo.personalWorkInjuryCardinal}
                    </if>
                    <if test="tSocialInfo.empId != null and tSocialInfo.empId.trim() != ''">
                        AND a.EMP_ID = #{tSocialInfo.empId}
                    </if>
                    <if test="tSocialInfo.empNo != null and tSocialInfo.empNo.trim() != ''">
                        AND a.EMP_NO = #{tSocialInfo.empNo}
                    </if>
                    <if test="tSocialInfo.empName != null and tSocialInfo.empName.trim() != ''">
                        AND a.EMP_NAME = #{tSocialInfo.empName}
                    </if>
                    <if test="tSocialInfo.empIdcard != null and tSocialInfo.empIdcard.trim() != ''">
                        AND a.EMP_IDCARD = #{tSocialInfo.empIdcard}
                    </if>
                    <if test="tSocialInfo.unitPensionPer != null">
                        AND a.UNIT_PENSION_PER = #{tSocialInfo.unitPensionPer}
                    </if>
                    <if test="tSocialInfo.unitMedicalPer != null">
                        AND a.UNIT_MEDICAL_PER = #{tSocialInfo.unitMedicalPer}
                    </if>
                    <if test="tSocialInfo.unitUnemploymentPer != null">
                        AND a.UNIT_UNEMPLOYMENT_PER = #{tSocialInfo.unitUnemploymentPer}
                    </if>
                    <if test="tSocialInfo.unitWorkUnjuryPer != null">
                        AND a.UNIT_WORK_UNJURY_PER = #{tSocialInfo.unitWorkUnjuryPer}
                    </if>
                    <if test="tSocialInfo.unitBirthPer != null">
                        AND a.UNIT_BIRTH_PER = #{tSocialInfo.unitBirthPer}
                    </if>
                    <if test="tSocialInfo.personalPensionPer != null">
                        AND a.PERSONAL_PENSION_PER = #{tSocialInfo.personalPensionPer}
                    </if>
                    <if test="tSocialInfo.personalMedicalPer != null">
                        AND a.PERSONAL_MEDICAL_PER = #{tSocialInfo.personalMedicalPer}
                    </if>
                    <if test="tSocialInfo.personalUnemploymentPer != null">
                        AND a.PERSONAL_UNEMPLOYMENT_PER = #{tSocialInfo.personalUnemploymentPer}
                    </if>
                    <if test="tSocialInfo.auditStatus != null and tSocialInfo.auditStatus.trim() != ''">
                        AND a.AUDIT_STATUS = #{tSocialInfo.auditStatus}
                    </if>
                    <if test="tSocialInfo.handleStatus != null and tSocialInfo.handleStatus.trim() != ''">
                        AND a.HANDLE_STATUS = #{tSocialInfo.handleStatus}
                    </if>
                    <if test="tSocialInfo.draftStatus != null and tSocialInfo.draftStatus.trim() != ''">
                        AND a.DRAFT_STATUS = #{tSocialInfo.draftStatus}
                    </if>
363 364
                    <if test="tSocialInfo.cardinalId != null and tSocialInfo.cardinalId.trim() != ''">
                        AND a.CARDINAL_IID = #{tSocialInfo.cardinalId}
fangxinjiang's avatar
fangxinjiang committed
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 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566
                    </if>
                    <if test="tSocialInfo.oldId != null">
                        AND a.OLD_ID = #{tSocialInfo.oldId}
                    </if>
                    <if test="tSocialInfo.settleDomain != null and tSocialInfo.settleDomain.trim() != ''">
                        AND a.SETTLE_DOMAIN = #{tSocialInfo.settleDomain}
                    </if>
                    <if test="tSocialInfo.socialProvince != null and tSocialInfo.socialProvince.trim() != ''">
                        AND a.SOCIAL_PROVINCE = #{tSocialInfo.socialProvince}
                    </if>
                    <if test="tSocialInfo.socialCity != null and tSocialInfo.socialCity.trim() != ''">
                        AND a.SOCIAL_CITY = #{tSocialInfo.socialCity}
                    </if>
                    <if test="tSocialInfo.socialTown != null and tSocialInfo.socialTown.trim() != ''">
                        AND a.SOCIAL_TOWN = #{tSocialInfo.socialTown}
                    </if>
                    <if test="tSocialInfo.remark != null and tSocialInfo.remark.trim() != ''">
                        AND a.REMARK = #{tSocialInfo.remark}
                    </if>
                    <if test="tSocialInfo.deleteFlag != null and tSocialInfo.deleteFlag.trim() != ''">
                        AND a.DELETE_FLAG = #{tSocialInfo.deleteFlag}
                    </if>
                    <if test="tSocialInfo.unitPersionMoney != null">
                        AND a.UNIT_PERSION_MONEY = #{tSocialInfo.unitPersionMoney}
                    </if>
                    <if test="tSocialInfo.unitMedicalMoney != null">
                        AND a.UNIT_MEDICAL_MONEY = #{tSocialInfo.unitMedicalMoney}
                    </if>
                    <if test="tSocialInfo.unitUnemploymentMoney != null">
                        AND a.UNIT_UNEMPLOYMENT_MONEY = #{tSocialInfo.unitUnemploymentMoney}
                    </if>
                    <if test="tSocialInfo.unitInjuryMoney != null">
                        AND a.UNIT_INJURY_MONEY = #{tSocialInfo.unitInjuryMoney}
                    </if>
                    <if test="tSocialInfo.unitBirthMoney != null">
                        AND a.UNIT_BIRTH_MONEY = #{tSocialInfo.unitBirthMoney}
                    </if>
                    <if test="tSocialInfo.unitBigailmentMoney != null">
                        AND a.UNIT_BIGAILMENT_MONEY = #{tSocialInfo.unitBigailmentMoney}
                    </if>
                    <if test="tSocialInfo.personalPersionMoney != null">
                        AND a.PERSONAL_PERSION_MONEY = #{tSocialInfo.personalPersionMoney}
                    </if>
                    <if test="tSocialInfo.personalMedicalMoney != null">
                        AND a.PERSONAL_MEDICAL_MONEY = #{tSocialInfo.personalMedicalMoney}
                    </if>
                    <if test="tSocialInfo.personalUnemploymentMoney != null">
                        AND a.PERSONAL_UNEMPLOYMENT_MONEY = #{tSocialInfo.personalUnemploymentMoney}
                    </if>
                    <if test="tSocialInfo.personalBigailmentMoney != null">
                        AND a.PERSONAL_BIGAILMENT_MONEY = #{tSocialInfo.personalBigailmentMoney}
                    </if>
                    <if test="tSocialInfo.valueType != null and tSocialInfo.valueType.trim() != ''">
                        AND a.VALUE_TYPE = #{tSocialInfo.valueType}
                    </if>
                    <if test="tSocialInfo.personalBigailmentPer != null">
                        AND a.PERSONAL_BIGAILMENT_PER = #{tSocialInfo.personalBigailmentPer}
                    </if>
                    <if test="tSocialInfo.unitBigailmentPer != null">
                        AND a.UNIT_BIGAILMENT_PER = #{tSocialInfo.unitBigailmentPer}
                    </if>
                    <if test="tSocialInfo.isIllness != null and tSocialInfo.isIllness.trim() != ''">
                        AND a.IS_ILLNESS = #{tSocialInfo.isIllness}
                    </if>
                    <if test="tSocialInfo.collectMoth != null">
                        AND a.COLLECT_MOTH = #{tSocialInfo.collectMoth}
                    </if>
                    <if test="tSocialInfo.collectType != null and tSocialInfo.collectType.trim() != ''">
                        AND a.COLLECT_TYPE = #{tSocialInfo.collectType}
                    </if>
                    <if test="tSocialInfo.processInstId != null and tSocialInfo.processInstId.trim() != ''">
                        AND a.PROCESS_INST_ID = #{tSocialInfo.processInstId}
                    </if>
                    <if test="tSocialInfo.auditUser != null and tSocialInfo.auditUser.trim() != ''">
                        AND a.AUDIT_USER = #{tSocialInfo.auditUser}
                    </if>
                    <if test="tSocialInfo.auditTime != null">
                        AND a.AUDIT_TIME = #{tSocialInfo.auditTime}
                    </if>
                    <if test="tSocialInfo.handleUser != null and tSocialInfo.handleUser.trim() != ''">
                        AND a.HANDLE_USER = #{tSocialInfo.handleUser}
                    </if>
                    <if test="tSocialInfo.handleTime != null">
                        AND a.HANDLE_TIME = #{tSocialInfo.handleTime}
                    </if>
                    <if test="tSocialInfo.belongUnit != null and tSocialInfo.belongUnit.trim() != ''">
                        AND a.BELONG_UNIT = #{tSocialInfo.belongUnit}
                    </if>
                    <if test="tSocialInfo.socialReduceDate != null">
                        AND a.SOCIAL_REDUCE_DATE = #{tSocialInfo.socialReduceDate}
                    </if>
                    <if test="tSocialInfo.canOverpay != null and tSocialInfo.canOverpay.trim() != ''">
                        AND a.CAN_OVERPAY = #{tSocialInfo.canOverpay}
                    </if>
                    <if test="tSocialInfo.overpayNumber != null">
                        AND a.OVERPAY_NUMBER = #{tSocialInfo.overpayNumber}
                    </if>
                    <if test="tSocialInfo.haveThisMonth != null and tSocialInfo.haveThisMonth.trim() != ''">
                        AND a.HAVE_THIS_MONTH = #{tSocialInfo.haveThisMonth}
                    </if>
                    <if test="tSocialInfo.insurancePension != null and tSocialInfo.insurancePension.trim() != ''">
                        AND a.INSURANCE_PENSION = #{tSocialInfo.insurancePension}
                    </if>
                    <if test="tSocialInfo.insuranceMedical != null and tSocialInfo.insuranceMedical.trim() != ''">
                        AND a.INSURANCE_MEDICAL = #{tSocialInfo.insuranceMedical}
                    </if>
                    <if test="tSocialInfo.insuranceUnemployment != null and tSocialInfo.insuranceUnemployment.trim() != ''">
                        AND a.INSURANCE_UNEMPLOYMENT = #{tSocialInfo.insuranceUnemployment}
                    </if>
                    <if test="tSocialInfo.insuranceInjury != null and tSocialInfo.insuranceInjury.trim() != ''">
                        AND a.INSURANCE_INJURY = #{tSocialInfo.insuranceInjury}
                    </if>
                    <if test="tSocialInfo.insuranceBirth != null and tSocialInfo.insuranceBirth.trim() != ''">
                        AND a.INSURANCE_BIRTH = #{tSocialInfo.insuranceBirth}
                    </if>
                    <if test="tSocialInfo.insuranceBigailment != null and tSocialInfo.insuranceBigailment.trim() != ''">
                        AND a.INSURANCE_BIGAILMENT = #{tSocialInfo.insuranceBigailment}
                    </if>
                    <if test="tSocialInfo.insuranceIsLatestCardinality != null and tSocialInfo.insuranceIsLatestCardinality.trim() != ''">
                        AND a.INSURANCE_IS_LATEST_CARDINALITY = #{tSocialInfo.insuranceIsLatestCardinality}
                    </if>
                    <if test="tSocialInfo.reduceHandleUser != null and tSocialInfo.reduceHandleUser.trim() != ''">
                        AND a.REDUCE_HANDLE_USER = #{tSocialInfo.reduceHandleUser}
                    </if>
                    <if test="tSocialInfo.reduceHandleTime != null">
                        AND a.REDUCE_HANDLE_TIME = #{tSocialInfo.reduceHandleTime}
                    </if>
                    <if test="tSocialInfo.isChargePersonal != null and tSocialInfo.isChargePersonal.trim() != ''">
                        AND a.IS_CHARGE_PERSONAL = #{tSocialInfo.isChargePersonal}
                    </if>
                    <if test="tSocialInfo.trustRemark != null and tSocialInfo.trustRemark.trim() != ''">
                        AND a.TRUST_REMARK = #{tSocialInfo.trustRemark}
                    </if>
                    <if test="tSocialInfo.reduceCan != null and tSocialInfo.reduceCan.trim() != ''">
                        AND a.REDUCE_CAN = #{tSocialInfo.reduceCan}
                    </if>
                    <if test="tSocialInfo.inauguralTeam != null and tSocialInfo.inauguralTeam.trim() != ''">
                        AND a.INAUGURAL_TEAM = #{tSocialInfo.inauguralTeam}
                    </if>
                    <if test="tSocialInfo.telecomNumber != null and tSocialInfo.telecomNumber.trim() != ''">
                        AND a.TELECOM_NUMBER = #{tSocialInfo.telecomNumber}
                    </if>
                    <if test="tSocialInfo.paymentType != null and tSocialInfo.paymentType.trim() != ''">
                        AND a.PAYMENT_TYPE = #{tSocialInfo.paymentType}
                    </if>
                    <if test="tSocialInfo.recordBase != null and tSocialInfo.recordBase.trim() != ''">
                        AND a.RECORD_BASE = #{tSocialInfo.recordBase}
                    </if>
                    <if test="tSocialInfo.socialType != null">
                        AND a.SOCIAL_TYPE = #{tSocialInfo.socialType}
                    </if>
                    <if test="tSocialInfo.bigailmentVaryFlag != null and tSocialInfo.bigailmentVaryFlag.trim() != ''">
                        AND a.BIGAILMENT_VARY_FLAG = #{tSocialInfo.bigailmentVaryFlag}
                    </if>
                    <if test="tSocialInfo.pensionStart != null">
                        AND a.PENSION_START = #{tSocialInfo.pensionStart}
                    </if>
                    <if test="tSocialInfo.medicalStart != null">
                        AND a.MEDICAL_START = #{tSocialInfo.medicalStart}
                    </if>
                    <if test="tSocialInfo.unemployStart != null">
                        AND a.UNEMPLOY_START = #{tSocialInfo.unemployStart}
                    </if>
                    <if test="tSocialInfo.workInjuryStart != null">
                        AND a.WORK_INJURY_START = #{tSocialInfo.workInjuryStart}
                    </if>
                    <if test="tSocialInfo.birthStart != null">
                        AND a.BIRTH_START = #{tSocialInfo.birthStart}
                    </if>
                    <if test="tSocialInfo.bigailmentStart != null">
                        AND a.BIGAILMENT_START = #{tSocialInfo.bigailmentStart}
                    </if>
                    <if test="tSocialInfo.pensionHandle != null and tSocialInfo.pensionHandle.trim() != ''">
                        AND a.PENSION_HANDLE = #{tSocialInfo.pensionHandle}
                    </if>
                    <if test="tSocialInfo.medicalHandle != null and tSocialInfo.medicalHandle.trim() != ''">
                        AND a.MEDICAL_HANDLE = #{tSocialInfo.medicalHandle}
                    </if>
                    <if test="tSocialInfo.unemployHandle != null and tSocialInfo.unemployHandle.trim() != ''">
                        AND a.UNEMPLOY_HANDLE = #{tSocialInfo.unemployHandle}
                    </if>
                    <if test="tSocialInfo.workInjuryHandle != null and tSocialInfo.workInjuryHandle.trim() != ''">
                        AND a.WORK_INJURY_HANDLE = #{tSocialInfo.workInjuryHandle}
                    </if>
                    <if test="tSocialInfo.birthHandle != null and tSocialInfo.birthHandle.trim() != ''">
                        AND a.BIRTH_HANDLE = #{tSocialInfo.birthHandle}
                    </if>
                    <if test="tSocialInfo.bigailmentHandle != null and tSocialInfo.bigailmentHandle.trim() != ''">
                        AND a.BIGAILMENT_HANDLE = #{tSocialInfo.bigailmentHandle}
                    </if>
                    <if test="tSocialInfo.createBy != null and tSocialInfo.createBy.trim() != ''">
                        AND a.CREATE_BY = #{tSocialInfo.createBy}
                    </if>
                    <if test="tSocialInfo.updateBy != null and tSocialInfo.updateBy.trim() != ''">
                        AND a.UPDATE_BY = #{tSocialInfo.updateBy}
                    </if>
                    <if test="tSocialInfo.createName != null and tSocialInfo.createName.trim() != ''">
                        AND a.CREATE_NAME = #{tSocialInfo.createName}
                    </if>
                    <if test="tSocialInfo.updateTime != null">
                        AND a.UPDATE_TIME = #{tSocialInfo.updateTime}
                    </if>
567 568 569 570 571 572 573 574 575 576 577 578 579 580 581


					<if test="tSocialInfo.ygsHandleStatus != null and tSocialInfo.ygsHandleStatus.trim() != ''">
						AND a.YGS_HANDLE_STATUS = #{tSocialInfo.ygsHandleStatus}
					</if>
					<if test="tSocialInfo.ysdHandleStatus != null and tSocialInfo.ysdHandleStatus.trim() != ''">
						AND a.YSD_HANDLE_STATUS = #{tSocialInfo.ysdHandleStatus}
					</if>
					<if test="tSocialInfo.ygsRemark != null and tSocialInfo.ygsRemark.trim() != ''">
						AND a.YGS_REMARK like concat('%',#{tSocialInfo.ygsRemark},'%')
					</if>
					<if test="tSocialInfo.ysdRemark != null and tSocialInfo.ysdRemark.trim() != ''">
						AND a.YSD_REMARK like concat('%',#{tSocialInfo.ysdRemark},'%')
					</if>
		</if>
fangxinjiang's avatar
fangxinjiang committed
582 583 584 585 586 587 588 589 590 591 592
    </sql>
    <!--tSocialInfo简单分页查询-->
    <select id="getTSocialInfoPage" resultMap="tSocialInfoMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM t_social_info a
        <where>
            1=1
            <include refid="tSocialInfo_where"/>
        </where>
    </select>
593 594 595 596 597

    <!-- 获取所有需要自动办理的养工失 -->
    <select id="getSocialSoldierYgsAll" resultMap="tSocialInfoMap">
        SELECT
			a.ID,
598
			a.SOCIAL_PROVINCE,
599 600
			a.EMP_NAME,
			a.SOCIAL_HOUSEHOLD_NAME,
601 602 603 604
			a.EMP_IDCARD,
			a.YGS_ADD_ID,
			a.HANDLE_STATUS,
			a.YGS_HANDLE_STATUS,
605 606
			SUBSTRING_INDEX(GROUP_CONCAT(d.id ORDER BY d.CREATE_TIME desc),',',1) as DISPATCH_ID,
			SUBSTRING_INDEX(GROUP_CONCAT(d.type ORDER BY d.CREATE_TIME desc),',',1) as DISPATCH_TYPE,
607
if((sd.id is not null and NOW() <![CDATA[ <= ]]> sd.SOCIAL_END_DATE) or ( sd.id is null and DATE_FORMAT(d.AUDIT_TIME,'%Y%m') = DATE_FORMAT(now(),'%Y%m')),0 ,1) YGS_OVER_DUE_FLAG
608 609
        FROM t_social_info a
        left join t_dispatch_info d on d.SOCIAL_ID = a.id
610 611 612 613
		left join t_social_deadline_info sd on sd.MONTH = DATE_FORMAT(d.AUDIT_TIME,'%Y%m') and sd.STATUS = '0'
			and sd.PROVINCE=a.SOCIAL_PROVINCE and sd.CITY=a.SOCIAL_CITY and ( (a.SOCIAL_TOWN is null and sd.TOWN is null) or (sd.TOWN=a.SOCIAL_TOWN))
		where a.YGS_ADD_ID is not null and d.AUTO_FLAG='0'
		  and (DATE_FORMAT(d.AUDIT_TIME,'%Y%m') = DATE_FORMAT(now(),'%Y%m') or DATE_FORMAT(d.AUDIT_TIME,'%Y%m') = DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 MONTH),'%Y%m'))
614 615 616 617 618 619 620 621
		  and a.YGS_HANDLE_STATUS in ('1','2','3')
		group by a.id
	</select>

	<!-- 获取所有需要自动办理的医生大 -->
    <select id="getSocialSoldierYsdAll" resultMap="tSocialInfoMap">
		SELECT
			a.ID,
622
			a.SOCIAL_PROVINCE,
623 624
			a.EMP_NAME,
			a.SOCIAL_HOUSEHOLD_NAME,
625 626 627 628
			a.EMP_IDCARD,
			a.YSD_ADD_ID,
			a.HANDLE_STATUS,
			a.YSD_HANDLE_STATUS,
629 630
			SUBSTRING_INDEX(GROUP_CONCAT(d.id ORDER BY d.CREATE_TIME desc),',',1) as DISPATCH_ID,
			SUBSTRING_INDEX(GROUP_CONCAT(d.type ORDER BY d.CREATE_TIME desc),',',1) as DISPATCH_TYPE,
631
		if((sd.id is not null and NOW() <![CDATA[ <= ]]> sd.MEDICAL_END_DATE) or ( sd.id is null and DATE_FORMAT(d.AUDIT_TIME,'%Y%m') = DATE_FORMAT(now(),'%Y%m')),0 ,1) YSD_OVER_DUE_FLAG
632 633
		FROM t_social_info a
				 left join t_dispatch_info d on d.SOCIAL_ID = a.id
634 635
				 left join t_social_deadline_info sd on sd.MONTH = DATE_FORMAT(d.AUDIT_TIME,'%Y%m') and sd.STATUS = '0'
			and sd.PROVINCE=a.SOCIAL_PROVINCE and sd.CITY=a.SOCIAL_CITY and ( (a.SOCIAL_TOWN is null and sd.TOWN is null) or (sd.TOWN=a.SOCIAL_TOWN))
636
		where a.YSD_ADD_ID is not null and d.AUTO_FLAG='0'
637
		  and (DATE_FORMAT(d.AUDIT_TIME,'%Y%m') = DATE_FORMAT(now(),'%Y%m') or DATE_FORMAT(d.AUDIT_TIME,'%Y%m') = DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 MONTH),'%Y%m'))
638 639 640 641
		  and a.YSD_HANDLE_STATUS in ('1','2','3')
		group by a.id
    </select>

642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660
	<!-- 获取所有需要自动办理的养工失 -->
    <select id="getSocialFriendYgsAll" resultMap="tSocialInfoMap">
        SELECT
			a.ID,
			a.EMP_NAME,
			a.SOCIAL_HOUSEHOLD_NAME,
			a.EMP_IDCARD,
			a.YGS_REQUEST_ID,
			a.HANDLE_STATUS,
			a.YGS_HANDLE_STATUS,
			SUBSTRING_INDEX(GROUP_CONCAT(d.id ORDER BY d.CREATE_TIME desc),',',1) as DISPATCH_ID,
			SUBSTRING_INDEX(GROUP_CONCAT(d.type ORDER BY d.CREATE_TIME desc),',',1) as DISPATCH_TYPE,
if((sd.id is not null and NOW() <![CDATA[ <= ]]> sd.SOCIAL_END_DATE) or ( sd.id is null and DATE_FORMAT(d.AUDIT_TIME,'%Y%m') = DATE_FORMAT(now(),'%Y%m')),0 ,1) YGS_OVER_DUE_FLAG
        FROM t_social_info a
        left join t_dispatch_info d on d.SOCIAL_ID = a.id
		left join t_social_deadline_info sd on sd.MONTH = DATE_FORMAT(d.AUDIT_TIME,'%Y%m') and sd.STATUS = '0'
			and sd.PROVINCE=a.SOCIAL_PROVINCE and sd.CITY=a.SOCIAL_CITY and ( (a.SOCIAL_TOWN is null and sd.TOWN is null) or (sd.TOWN=a.SOCIAL_TOWN))
		where a.YGS_REQUEST_ID is not null and d.AUTO_FLAG='0'
		  and (DATE_FORMAT(d.AUDIT_TIME,'%Y%m') = DATE_FORMAT(now(),'%Y%m') or DATE_FORMAT(d.AUDIT_TIME,'%Y%m') = DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 MONTH),'%Y%m'))
661
		  and a.YGS_HANDLE_STATUS in ('1','2')
662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683
		group by a.id
	</select>

	<!-- 获取所有需要自动办理的医生大 -->
    <select id="getSocialFriendYsdAll" resultMap="tSocialInfoMap">
		SELECT
			a.ID,
			a.EMP_NAME,
			a.SOCIAL_HOUSEHOLD_NAME,
			a.EMP_IDCARD,
			a.YSD_REQUEST_ID,
			a.HANDLE_STATUS,
			a.YSD_HANDLE_STATUS,
			SUBSTRING_INDEX(GROUP_CONCAT(d.id ORDER BY d.CREATE_TIME desc),',',1) as DISPATCH_ID,
			SUBSTRING_INDEX(GROUP_CONCAT(d.type ORDER BY d.CREATE_TIME desc),',',1) as DISPATCH_TYPE,
		if((sd.id is not null and NOW() <![CDATA[ <= ]]> sd.MEDICAL_END_DATE) or ( sd.id is null and DATE_FORMAT(d.AUDIT_TIME,'%Y%m') = DATE_FORMAT(now(),'%Y%m')),0 ,1) YSD_OVER_DUE_FLAG
		FROM t_social_info a
				 left join t_dispatch_info d on d.SOCIAL_ID = a.id
				 left join t_social_deadline_info sd on sd.MONTH = DATE_FORMAT(d.AUDIT_TIME,'%Y%m') and sd.STATUS = '0'
			and sd.PROVINCE=a.SOCIAL_PROVINCE and sd.CITY=a.SOCIAL_CITY and ( (a.SOCIAL_TOWN is null and sd.TOWN is null) or (sd.TOWN=a.SOCIAL_TOWN))
		where a.YSD_REQUEST_ID is not null and d.AUTO_FLAG='0'
		  and (DATE_FORMAT(d.AUDIT_TIME,'%Y%m') = DATE_FORMAT(now(),'%Y%m') or DATE_FORMAT(d.AUDIT_TIME,'%Y%m') = DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 MONTH),'%Y%m'))
684
		  and a.YSD_HANDLE_STATUS in ('1','2')
685 686 687
		group by a.id
    </select>

688 689 690 691
    <!-- 获取所有需要社保局审核的养工失 -->
    <select id="getSocialSoldierYgsByAudit" resultMap="tSocialInfoMap">
        SELECT
			a.ID,
692 693
			a.EMP_NAME,
			a.SOCIAL_HOUSEHOLD_NAME,
694 695 696 697
			a.EMP_IDCARD,
			a.YGS_ADD_ID,
			a.HANDLE_STATUS,
			a.YGS_HANDLE_STATUS,
698
			SUBSTRING_INDEX(GROUP_CONCAT(d.id ORDER BY d.CREATE_TIME desc),',',1) as DISPATCH_ID,
699
			SUBSTRING_INDEX(GROUP_CONCAT(d.type ORDER BY d.CREATE_TIME desc),',',1) as DISPATCH_TYPE
700 701 702 703 704 705 706 707 708 709 710 711
        FROM t_social_info a
        left join t_dispatch_info d on d.SOCIAL_ID = a.id
		where a.YGS_ADD_ID is not null and d.AUTO_FLAG='0'
		  and (DATE_FORMAT(d.AUDIT_TIME,'%Y%m') = DATE_FORMAT(now(),'%Y%m') or DATE_FORMAT(d.AUDIT_TIME,'%Y%m') = DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 MONTH),'%Y%m'))
		  and a.YGS_HANDLE_STATUS = '7'
		group by a.id
	</select>

	<!-- 获取所有需要社保局审核的医生大 -->
    <select id="getSocialSoldierYsdByAudit" resultMap="tSocialInfoMap">
		SELECT
			a.ID,
712 713
			a.EMP_NAME,
			a.SOCIAL_HOUSEHOLD_NAME,
714 715 716 717
			a.EMP_IDCARD,
			a.YSD_ADD_ID,
			a.HANDLE_STATUS,
			a.YSD_HANDLE_STATUS,
718
			SUBSTRING_INDEX(GROUP_CONCAT(d.id ORDER BY d.CREATE_TIME desc),',',1) as DISPATCH_ID,
719
			SUBSTRING_INDEX(GROUP_CONCAT(d.type ORDER BY d.CREATE_TIME desc),',',1) as DISPATCH_TYPE
720 721 722 723 724 725 726 727
		FROM t_social_info a
				 left join t_dispatch_info d on d.SOCIAL_ID = a.id
		where a.YSD_ADD_ID is not null and d.AUTO_FLAG='0'
		  and (DATE_FORMAT(d.AUDIT_TIME,'%Y%m') = DATE_FORMAT(now(),'%Y%m') or DATE_FORMAT(d.AUDIT_TIME,'%Y%m') = DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 MONTH),'%Y%m'))
		  and a.YSD_HANDLE_STATUS = '7'
		group by a.id
    </select>

728 729 730 731
	<!-- 根据任务ID,获取需要自动办理的社保 -->
    <select id="getSocialSoldierByAddId" resultMap="tSocialInfoMap">
        SELECT
			a.ID,
732 733
			a.EMP_NAME,
			a.SOCIAL_HOUSEHOLD_NAME,
734 735 736 737 738 739 740 741 742 743 744 745
			a.EMP_IDCARD,
			a.YGS_ADD_ID,
			a.YSD_ADD_ID,
			a.HANDLE_STATUS,
			a.YGS_HANDLE_STATUS,
			a.YSD_HANDLE_STATUS,
			d.id as DISPATCH_ID
        FROM t_social_info a
		left join t_dispatch_info d on d.SOCIAL_ID = a.id
        where a.YGS_ADD_ID = #{addId} or a.YSD_ADD_ID = #{addId}
    </select>

fangxinjiang's avatar
fangxinjiang committed
746
</mapper>