huliguo
2025-04-30 16427ab3e7335fb6242699ee4afb9881dfd13439
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
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
118
119
120
121
122
123
124
125
126
127
<?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.cl.mapper.DataMapper">
 
 
    <select id="screen" resultType="com.cl.pojo.entity.DataEntity">
        WITH latest_records AS (
            SELECT
                *,
                ROW_NUMBER() OVER (PARTITION BY county ORDER BY create_time DESC) AS rn
            FROM t_data
            WHERE county=#{county} or #{county}=0 AND del_flag = 0
        )
        SELECT
            create_time,
            sum(certificate_eyesight) AS certificate_eyesight,
            sum(certificate_intellect) AS certificate_intellect ,
            sum(certificate_limb) AS certificate_limb ,
            sum(certificate_speech) AS certificate_speech,
            sum(certificate_hearing) AS certificate_hearing,
            sum(certificate_spirit) AS certificate_spirit,
            sum(certificate_multiple) AS certificate_multiple,
            sum(worker_city) AS worker_city,
            sum(worker_association) AS worker_association,
            sum(worker_service_corps) AS worker_service_corps,
            sum(worker_county  ) AS worker_county,
            sum(worker_township  ) AS worker_township,
            sum(worker_village  ) AS worker_village,
            sum(drill_autism  ) AS drill_autism,
            sum(drill_intellect  ) AS drill_intellect,
            sum(drill_limb  ) AS drill_limb,
            sum(drill_speech  ) AS drill_speech,
            sum(drill_hearing  ) AS drill_hearing,
            sum(drill_spirit  ) AS drill_spirit,
            sum(salvation_before_seven  ) AS salvation_before_seven,
            sum(salvation_after_seven  ) AS salvation_after_seven,
            sum(salvation_autism  ) AS salvation_autism,
            sum(salvation_intellect  ) AS salvation_intellect,
            sum(salvation_limb  ) AS salvation_limb,
            sum(salvation_speech  ) AS salvation_speech,
            sum(difficulty_medication  ) AS difficulty_medication,
            sum(difficulty_hospitalisation  ) AS difficulty_hospitalisation,
            sum(assistive_device_total  ) AS assistive_device_total,
            sum(assistive_device_one  ) AS assistive_device_one,
            sum(assistive_device_two  ) AS assistive_device_two,
            sum(assistive_device_three  ) AS assistive_device_three,
            sum(assistive_device_other  ) AS assistive_device_other,
            sum(assistive_device_type_one  ) AS assistive_device_type_one,
            sum(assistive_device_type_two  ) AS assistive_device_type_two,
            sum(assistive_device_type_three  ) AS assistive_device_type_three,
            sum(assistive_device_type_four  ) AS assistive_device_type_four,
            sum(assistive_device_grade_one  ) AS assistive_device_grade_one ,
            sum( assistive_device_grade_two) as  assistive_device_grade_two,
            sum(assistive_device_grade_three ) as  assistive_device_grade_three,
            sum(assistive_device_grade_four ) as assistive_device_grade_four ,
            sum(technical_training ) as technical_training ,
            sum(home_allowance ) as home_allowance  ,
            sum(statutory_certificate_eyesight ) as statutory_certificate_eyesight ,
            sum(statutory_certificate_intellect ) as  statutory_certificate_intellect,
            sum(statutory_certificate_limb ) as  statutory_certificate_limb,
            sum(statutory_certificate_speech ) as statutory_certificate_speech ,
            sum(statutory_certificate_hearing ) as statutory_certificate_hearing  ,
            sum(employed_employment ) as  employed_employment,
            sum(employed_concentrated ) as employed_concentrated ,
            sum(employed_public_welfare ) as employed_public_welfare ,
            sum(employed_auxiliary ) as employed_auxiliary ,
            sum(employed_individual ) as employed_individual ,
            sum(high_school_employment ) as high_school_employment ,
            sum(high_school_individual ) as high_school_individual ,
            sum(high_school_flexible ) as  high_school_flexible,
            sum(education_one ) as  education_one,
            sum(education_two ) as education_two ,
            sum( education_three) as education_three ,
            sum(education_four ) as  education_four,
            sum(education_five ) as education_five ,
            sum(education_six ) as education_six ,
            sum(education_seven ) as education_seven ,
            sum(education_eight ) as education_eight ,
            sum(education_nine ) as education_nine ,
            sum(education_subsidy ) as education_subsidy ,
            sum(activity_frequency ) as  activity_frequency,
            sum(education_number ) as education_number,
            sum(matter) as matter,
            sum(doctor_apprecitation) as doctor_apprecitation,
            sum(remould) as remould,
            sum(interviews_office) as interviews_office,
            sum(interviews_phone) as interviews_phone ,
            sum(interviews_superior) as interviews_superior,
            sum(interviews_hotline) as interviews_hotline
        FROM latest_records
        WHERE rn = 1;
    </select>
    <select id="pageList" resultType="com.cl.pojo.vo.DataVO">
        SELECT
            d.county,
            d.investigate_time,
            d.create_time,
            creator.name AS createName,
            d.update_time,
            updater.name AS updateName
        FROM
            t_data d
                LEFT JOIN
            t_user creator ON d.create_by = creator.id
                LEFT JOIN
            t_user updater ON d.update_by = updater.id
        WHERE
            d.del_flag=0
        <if test="county != null and county != 0">
            and d.county =#{county}
        </if>
        <if test="name!=null and ''!=name">
            and creator.name like concat('%',#{name},'%')
        </if>
    </select>
    <select id="beforeOne" resultType="com.cl.pojo.entity.DataEntity">
 
        SELECT *
        FROM t_data
        WHERE del_flag = 0
        AND county = (SELECT county FROM t_data WHERE id = #{id} AND del_flag = 0)
        AND create_time &lt; (SELECT create_time FROM t_data WHERE id = #{id} AND del_flag = 0)
        ORDER BY create_time DESC
        LIMIT 1;
 
    </select>
</mapper>