PatientService.xml 10.8 KB
   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
 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
<?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.lyms.platform.permission.dao.master.PatientServiceMapper">

<resultMap id="PatientServiceResultMap" type="com.lyms.platform.permission.model.PatientService">
<id column="id" property="id" jdbcType="VARCHAR"/>
<result column="parentid" property="parentid" jdbcType="VARCHAR"/>
<result column="pid" property="pid" jdbcType="VARCHAR"/>
<result column="ser_type" property="serType" jdbcType="INTEGER"/>
<result column="ser_doct" property="serDoct" jdbcType="VARCHAR"/>
<result column="create_date" property="createDate" jdbcType="TIMESTAMP"/>
<result column="create_user_name" property="createUserName" jdbcType="VARCHAR"/>
<result column="create_user" property="createUser" jdbcType="VARCHAR"/>
<result column="ser_status" property="serStatus" jdbcType="INTEGER"/>
<result column="update_date" property="updateDate" jdbcType="TIMESTAMP"/>
<result column="update_user_name" property="updateUserName" jdbcType="VARCHAR"/>
<result column="update_user" property="updateUser" jdbcType="VARCHAR"/>
<result column="hospital_id" property="hospitalId" jdbcType="VARCHAR"/>
<result column="ser_code" property="serCode" jdbcType="VARCHAR"/>
<result column="status" property="status" jdbcType="INTEGER"/>
<result column="receive_date" property="receiveDate" jdbcType="TIMESTAMP"/>
<result column="receive_user" property="receiveUser" jdbcType="VARCHAR"/>
<result column="back_date" property="backDate" jdbcType="TIMESTAMP"/>
<result column="back_user" property="backUser" jdbcType="VARCHAR"/>
<result column="order_id" property="orderId" jdbcType="VARCHAR"/>
<result column="syn_status" property="synStatus" jdbcType="INTEGER"/>
<result column="is_old" property="isOld" jdbcType="INTEGER"/>
</resultMap>


<insert id="addPatientService" parameterType="com.lyms.platform.permission.model.PatientService">
insert into patient_service (id,parentid,pid,ser_type,ser_doct,create_date,create_user_name,create_user,ser_status,update_date,update_user_name,update_user,hospital_id,ser_code,status,receive_date,receive_user,back_date,back_user,order_id,syn_status,is_old) values (#{id},#{parentid},#{pid},#{serType},#{serDoct},#{createDate},#{createUserName},#{createUser},#{serStatus},#{updateDate},#{updateUserName},#{updateUser},#{hospitalId},#{serCode},#{status},#{receiveDate},#{receiveUser},#{backDate},#{backUser},#{orderId},#{synStatus},#{isOld})
</insert>


<update id="updatePatientService" parameterType="com.lyms.platform.permission.model.PatientService">
update patient_service
<set>
ser_doct = #{serDoct,jdbcType=VARCHAR},
create_user = #{createUser,jdbcType=VARCHAR},
update_user = #{updateUser,jdbcType=VARCHAR},
<if test="parentid != null and parentid != ''">
parentid = #{parentid,jdbcType=VARCHAR},
</if>
<if test="pid != null and pid != ''">
pid = #{pid,jdbcType=VARCHAR},
</if>
<if test="serType != null and serType >= 0">
ser_type = #{serType,jdbcType=INTEGER},
</if>

<if test="createDate != null">
create_date = #{createDate,jdbcType=TIMESTAMP},
</if>
<if test="createUserName != null and createUserName != ''">
create_user_name = #{createUserName,jdbcType=VARCHAR},
</if>
<if test="serStatus != null and serStatus >= 0">
ser_status = #{serStatus,jdbcType=INTEGER},
</if>
<if test="updateDate != null">
update_date = #{updateDate,jdbcType=TIMESTAMP},
</if>
<if test="updateUserName != null and updateUserName != ''">
update_user_name = #{updateUserName,jdbcType=VARCHAR},
</if>
<if test="hospitalId != null and hospitalId != ''">
hospital_id = #{hospitalId,jdbcType=VARCHAR},
</if>
<if test="serCode != null and serCode != ''">
ser_code = #{serCode,jdbcType=VARCHAR},
</if>
<if test="status != null and status >= 0">
status = #{status,jdbcType=INTEGER},
</if>
<if test="receiveDate != null">
receive_date = #{receiveDate,jdbcType=TIMESTAMP},
</if>
<if test="receiveUser != null and receiveUser != ''">
receive_user = #{receiveUser,jdbcType=VARCHAR},
</if>
<if test="backDate != null">
back_date = #{backDate,jdbcType=TIMESTAMP},
</if>
<if test="backUser != null and backUser != ''">
back_user = #{backUser,jdbcType=VARCHAR},
</if>
<if test="orderId != null and orderId != ''">
order_id = #{orderId,jdbcType=VARCHAR},
</if>
<if test="synStatus != null and synStatus != ''">
syn_status = #{synStatus,jdbcType=INTEGER},
</if>
<if test="isOld != null and isOld != ''">
is_old = #{isOld,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>


<delete id="deletePatientService" parameterType="java.lang.String">
delete from patient_service where id = #{id,jdbcType=VARCHAR}
</delete>


<select id="getPatientService" resultMap="PatientServiceResultMap" parameterType="java.lang.String">
select id,parentid,pid,ser_type,ser_doct,create_date,create_user_name,create_user,ser_status,update_date,update_user_name,update_user,hospital_id,ser_code,status,receive_date,receive_user,back_date,back_user,order_id,syn_status,is_old
from patient_service where id = #{id,jdbcType=VARCHAR}
</select>


<sql id="orderAndLimit">
<if test="sort != null and sort != '' ">
order by ${sort}
<if test="need != null">
limit #{offset, jdbcType=INTEGER} , #{limit, jdbcType=INTEGER}
</if>
</if>
</sql>

<sql id="PatientServiceCondition">
<where>
1 = 1
<if test="id != null and id != ''">
and id = #{id,jdbcType=VARCHAR}
</if>
<if test="parentid != null and parentid != ''">
and parentid = #{parentid,jdbcType=VARCHAR}
</if>
<if test="parentIds!=null">
and parentid in (
<foreach item="parentid" collection="parentIds" separator=",">
#{parentid}
</foreach>
)
</if>
<if test="pid != null and pid != ''">
and pid = #{pid,jdbcType=VARCHAR}
</if>
<if test="serType != null and serType >= 0">
and ser_type = #{serType,jdbcType=INTEGER}
</if>
<if test="serDoct != null and serDoct != ''">
and ser_doct = #{serDoct,jdbcType=VARCHAR}
</if>
<if test="createDate != null">
and create_date = #{createDate,jdbcType=TIMESTAMP}
</if>
<if test="createStartDate != null">
AND
<![CDATA[
DATEDIFF(#{createStartDate},create_date)<=0
]]>
</if>
<if test="createEndDate != null">
AND
<![CDATA[
DATEDIFF(#{createEndDate},create_date)>=0
]]>
</if>
<if test="createUserName != null and createUserName != ''">
and create_user_name = #{createUserName,jdbcType=VARCHAR}
</if>
<if test="createUser != null and createUser != ''">
and create_user = #{createUser,jdbcType=VARCHAR}
</if>
<if test="serStatus != null and serStatus >= 0">
and ser_status = #{serStatus,jdbcType=INTEGER}
</if>
<if test="updateDate != null">
and update_date = #{updateDate,jdbcType=TIMESTAMP}
</if>
<if test="updateUserName != null and updateUserName != ''">
and update_user_name = #{updateUserName,jdbcType=VARCHAR}
</if>
<if test="updateUser != null and updateUser != ''">
and update_user = #{updateUser,jdbcType=VARCHAR}
</if>
<if test="hospitalId != null and hospitalId != ''">
and hospital_id = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="serCode != null and serCode != ''">
and ser_code = #{serCode,jdbcType=VARCHAR}
</if>
<if test="status != null and status >= 0">
and status = #{status,jdbcType=INTEGER}
</if>
<if test="receiveDate != null">
and receive_date = #{receiveDate,jdbcType=TIMESTAMP}
</if>
<if test="receiveUser != null and receiveUser != ''">
and receive_user = #{receiveUser,jdbcType=VARCHAR}
</if>
<if test="backDate != null">
and back_date = #{backDate,jdbcType=TIMESTAMP}
</if>
<if test="backUser != null and backUser != ''">
and back_user = #{backUser,jdbcType=VARCHAR}
</if>
<if test="orderId != null and orderId != ''">
and order_id = #{orderId,jdbcType=VARCHAR}
</if>
<if test="synStatus != null and synStatus != ''">
and syn_status = #{synStatus,jdbcType=INTEGER}
</if>
<if test="isOld != null and isOld != ''">
and is_old = #{isOld,jdbcType=INTEGER}
</if>
<if test="sql != null and sql != ''">
${sql}
</if>
</where>
</sql>

<select id="queryPatientService" resultMap="PatientServiceResultMap"
parameterType="com.lyms.platform.permission.model.PatientServiceQuery">
select
id,parentid,pid,ser_type,ser_doct,create_date,create_user_name,create_user,ser_status,update_date,update_user_name,update_user,hospital_id,ser_code,status,receive_date,receive_user,back_date,back_user,order_id,syn_status,is_old
from patient_service
<include refid="PatientServiceCondition"/>
<include refid="orderAndLimit"/>
</select>

<select id="queryPatientServiceCount" resultType="int"
parameterType="com.lyms.platform.permission.model.PatientServiceQuery">
select count(1) from patient_service
<include refid="PatientServiceCondition"/>
</select>

</mapper>