yxh
2025-02-14 3b0a4298b0d6e40b8afa371d221ff1b1ee748c80
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
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
<?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.smartor.mapper.PatMedRegistrationMapper">
 
    <resultMap type="com.smartor.domain.PatMedRegistration" id="PatMedRegistrationResult">
        <result property="registid" column="registid"/>
        <result property="serialnum" column="serialnum"/>
        <result property="patid" column="patid"/>
        <result property="hospitalname" column="hospitalname"/>
        <result property="hospitalcode" column="hospitalcode"/>
        <result property="deptcode" column="deptcode"/>
        <result property="deptname" column="deptname"/>
        <result property="deptid" column="deptid"/>
        <result property="state" column="state"/>
        <result property="appointmenttime" column="appointmenttime"/>
        <result property="appointmenttimetype" column="appointmenttimetype"/>
        <result property="appointmentcode" column="appointmentcode"/>
        <result property="appointmentbegintime" column="appointmentbegintime"/>
        <result property="appointmentendtime" column="appointmentendtime"/>
        <result property="orgid" column="orgid"/>
        <result property="delFlag" column="del_flag"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="isupload" column="isupload"/>
        <result property="uploadTime" column="upload_time"/>
        <result property="pid" column="pid"/>
        <result property="guid" column="guid"/>
    </resultMap>
 
    <sql id="selectPatMedRegistrationVo">
        select registid,
               serialnum,
               patid,
               hospitalname,
               hospitalcode,
               deptcode,
               deptname,
               deptid,
               state,
               appointmenttime,
               appointmenttimetype,
               appointmentcode,
               appointmentbegintime,
               appointmentendtime,
               orgid,
               del_flag,
               update_by,
               update_time,
               create_by,
               create_time,
               isupload,
               upload_time,
               pid,
               guid
        from pat_med_registration
    </sql>
 
    <select id="selectPatMedRegistrationList" parameterType="com.smartor.domain.PatMedRegistration"
            resultMap="PatMedRegistrationResult">
        <include refid="selectPatMedRegistrationVo"/>
        <where>
            <if test="serialnum != null  and serialnum != ''">and serialnum = #{serialnum}</if>
            <if test="patid != null ">and patid = #{patid}</if>
            <if test="hospitalname != null  and hospitalname != ''">and hospitalname like concat('%', #{hospitalname},
                '%')
            </if>
            <if test="hospitalcode != null  and hospitalcode != ''">and hospitalcode = #{hospitalcode}</if>
            <if test="deptcode != null  and deptcode != ''">and deptcode = #{deptcode}</if>
            <if test="deptname != null  and deptname != ''">and deptname like concat('%', #{deptname}, '%')</if>
            <if test="deptid != null ">and deptid = #{deptid}</if>
            <if test="state != null ">and state = #{state}</if>
            <if test="appointmenttime != null ">and appointmenttime = #{appointmenttime}</if>
            <if test="appointmenttimetype != null ">and appointmenttimetype = #{appointmenttimetype}</if>
            <if test="appointmentcode != null  and appointmentcode != ''">and appointmentcode = #{appointmentcode}</if>
            <if test="appointmentbegintime != null ">and appointmentbegintime = #{appointmentbegintime}</if>
            <if test="appointmentendtime != null ">and appointmentendtime = #{appointmentendtime}</if>
            <if test="orgid != null  and orgid != ''">and orgid = #{orgid}</if>
            <if test="isupload != null ">and isupload = #{isupload}</if>
            <if test="uploadTime != null ">and upload_time = #{uploadTime}</if>
            <if test="pid != null ">and pid = #{pid}</if>
            <if test="guid != null  and guid != ''">and guid = #{guid}</if>
        </where>
        order by create_time desc
    </select>
 
    <select id="selectPatMedRegistrationByRegistid" parameterType="Long" resultMap="PatMedRegistrationResult">
        <include refid="selectPatMedRegistrationVo"/>
        where registid = #{registid}
    </select>
 
    <insert id="insertPatMedRegistration" parameterType="com.smartor.domain.PatMedRegistration">
        insert into pat_med_registration
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="registid != null">registid,</if>
            <if test="serialnum != null">serialnum,</if>
            <if test="patid != null">patid,</if>
            <if test="hospitalname != null">hospitalname,</if>
            <if test="hospitalcode != null">hospitalcode,</if>
            <if test="deptcode != null">deptcode,</if>
            <if test="deptname != null">deptname,</if>
            <if test="deptid != null">deptid,</if>
            <if test="state != null">state,</if>
            <if test="appointmenttime != null">appointmenttime,</if>
            <if test="appointmenttimetype != null">appointmenttimetype,</if>
            <if test="appointmentcode != null">appointmentcode,</if>
            <if test="appointmentbegintime != null">appointmentbegintime,</if>
            <if test="appointmentendtime != null">appointmentendtime,</if>
            <if test="orgid != null">orgid,</if>
            <if test="delFlag != null">del_flag,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="isupload != null">isupload,</if>
            <if test="uploadTime != null">upload_time,</if>
            <if test="pid != null">pid,</if>
            <if test="guid != null">guid,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="registid != null">#{registid},</if>
            <if test="serialnum != null">#{serialnum},</if>
            <if test="patid != null">#{patid},</if>
            <if test="hospitalname != null">#{hospitalname},</if>
            <if test="hospitalcode != null">#{hospitalcode},</if>
            <if test="deptcode != null">#{deptcode},</if>
            <if test="deptname != null">#{deptname},</if>
            <if test="deptid != null">#{deptid},</if>
            <if test="state != null">#{state},</if>
            <if test="appointmenttime != null">#{appointmenttime},</if>
            <if test="appointmenttimetype != null">#{appointmenttimetype},</if>
            <if test="appointmentcode != null">#{appointmentcode},</if>
            <if test="appointmentbegintime != null">#{appointmentbegintime},</if>
            <if test="appointmentendtime != null">#{appointmentendtime},</if>
            <if test="orgid != null">#{orgid},</if>
            <if test="delFlag != null">#{delFlag},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="isupload != null">#{isupload},</if>
            <if test="uploadTime != null">#{uploadTime},</if>
            <if test="pid != null">#{pid},</if>
            <if test="guid != null">#{guid},</if>
        </trim>
    </insert>
 
    <update id="updatePatMedRegistration" parameterType="com.smartor.domain.PatMedRegistration">
        update pat_med_registration
        <trim prefix="SET" suffixOverrides=",">
            <if test="serialnum != null">serialnum = #{serialnum},</if>
            <if test="patid != null">patid = #{patid},</if>
            <if test="hospitalname != null">hospitalname = #{hospitalname},</if>
            <if test="hospitalcode != null">hospitalcode = #{hospitalcode},</if>
            <if test="deptcode != null">deptcode = #{deptcode},</if>
            <if test="deptname != null">deptname = #{deptname},</if>
            <if test="deptid != null">deptid = #{deptid},</if>
            <if test="state != null">state = #{state},</if>
            <if test="appointmenttime != null">appointmenttime = #{appointmenttime},</if>
            <if test="appointmenttimetype != null">appointmenttimetype = #{appointmenttimetype},</if>
            <if test="appointmentcode != null">appointmentcode = #{appointmentcode},</if>
            <if test="appointmentbegintime != null">appointmentbegintime = #{appointmentbegintime},</if>
            <if test="appointmentendtime != null">appointmentendtime = #{appointmentendtime},</if>
            <if test="orgid != null">orgid = #{orgid},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="isupload != null">isupload = #{isupload},</if>
            <if test="uploadTime != null">upload_time = #{uploadTime},</if>
            <if test="pid != null">pid = #{pid},</if>
            <if test="guid != null">guid = #{guid},</if>
        </trim>
        where registid = #{registid}
    </update>
 
    <delete id="deletePatMedRegistrationByRegistid" parameterType="Long">
        delete
        from pat_med_registration
        where registid = #{registid}
    </delete>
 
    <update id="deletePatMedRegistrationByRegistids" parameterType="Long">
        update pat_med_registration
        <trim prefix="SET" suffixOverrides=",">
            del_flag =1
        </trim>
        where registid in
        <foreach item="registid" collection="array" open="(" separator="," close=")">
            #{registid}
        </foreach>
    </update>
</mapper>