PatientMarkHospital.xml 12.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
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
<?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.PatientMarkHospitalMapper">

<resultMap id="PatientMarkHospitalResultMap" type="com.lyms.platform.permission.model.PatientMarkHospital">
<id column="id" property="id" jdbcType="VARCHAR"/>
<result column="patient_id" property="patientId" jdbcType="VARCHAR"/>
<result column="pid" property="pid" jdbcType="VARCHAR"/>
<result column="back_status" property="backStatus" jdbcType="INTEGER"/>
<result column="back_result" property="backResult" jdbcType="INTEGER"/>
<result column="back_doctor" property="backDoctor" jdbcType="VARCHAR"/>
<result column="back_date" property="backDate" jdbcType="TIMESTAMP"/>
<result column="back_make_date" property="backMakeDate" jdbcType="TIMESTAMP"/>
<result column="back_remark" property="backRemark" jdbcType="VARCHAR"/>
<result column="back_failure" property="backFailure" jdbcType="INTEGER"/>
<result column="in_hospit_status" property="inHospitStatus" jdbcType="INTEGER"/>
<result column="in_hospit_result" property="inHospitResult" jdbcType="INTEGER"/>
<result column="in_hospit_doctor" property="inHospitDoctor" jdbcType="VARCHAR"/>
<result column="in_hospit_date" property="inHospitDate" jdbcType="TIMESTAMP"/>
<result column="in_hospit_make_date" property="inHospitMakeDate" jdbcType="TIMESTAMP"/>
<result column="in_hospit_remark" property="inHospitRemark" jdbcType="VARCHAR"/>
<result column="in_hospit_failure" property="inHospitFailure" jdbcType="INTEGER"/>
<result column="make_in_hospit_date" property="makeInHospitDate" jdbcType="TIMESTAMP"/>
<result column="make_date" property="makeDate" jdbcType="TIMESTAMP"/>
<result column="make_doctor" property="makeDoctor" jdbcType="VARCHAR"/>
<result column="make_remark" property="makeRemark" jdbcType="VARCHAR"/>
<result column="hospital_id" property="hospitalId" jdbcType="VARCHAR"/>
<result column="hospit_status" property="hospitStatus" jdbcType="INTEGER"/>
<result column="hospit_date" property="hospitDate" jdbcType="TIMESTAMP"/>
<result column="hospit_type" property="hospitType" jdbcType="INTEGER"/>
</resultMap>


<insert id="addPatientMarkHospital" parameterType="com.lyms.platform.permission.model.PatientMarkHospital">
insert into patient_mark_hospital (id,patient_id,pid,back_status,back_result,back_doctor,back_date,back_make_date,back_remark,back_failure,in_hospit_status,in_hospit_result,in_hospit_doctor,in_hospit_date,in_hospit_make_date,in_hospit_remark,in_hospit_failure,make_in_hospit_date,make_date,make_doctor,make_remark,hospital_id,hospit_status,hospit_date,hospit_type) values (#{id},#{patientId},#{pid},#{backStatus},#{backResult},#{backDoctor},#{backDate},#{backMakeDate},#{backRemark},#{backFailure},#{inHospitStatus},#{inHospitResult},#{inHospitDoctor},#{inHospitDate},#{inHospitMakeDate},#{inHospitRemark},#{inHospitFailure},#{makeInHospitDate},#{makeDate},#{makeDoctor},#{makeRemark},#{hospitalId},#{hospitStatus},#{hospitDate},#{hospitType})
</insert>


<update id="updatePatientMarkHospital" parameterType="com.lyms.platform.permission.model.PatientMarkHospital">
update patient_mark_hospital
<set>
<if test="patientId != null and patientId != ''">
patient_id = #{patientId,jdbcType=VARCHAR},
</if>
<if test="pid != null and pid != ''">
pid = #{pid,jdbcType=VARCHAR},
</if>
<if test="backStatus != null and backStatus >= 0">
back_status = #{backStatus,jdbcType=INTEGER},
</if>
<if test="backResult != null and backResult >= 0">
back_result = #{backResult,jdbcType=INTEGER},
</if>
<if test="backDoctor != null and backDoctor != ''">
back_doctor = #{backDoctor,jdbcType=VARCHAR},
</if>
<if test="backDate != null">
back_date = #{backDate,jdbcType=TIMESTAMP},
</if>
<if test="backMakeDate != null">
back_make_date = #{backMakeDate,jdbcType=TIMESTAMP},
</if>
<if test="backRemark != null and backRemark != ''">
back_remark = #{backRemark,jdbcType=VARCHAR},
</if>
<if test="backFailure != null and backFailure >= 0">
back_failure = #{backFailure,jdbcType=INTEGER},
</if>
<if test="inHospitStatus != null and inHospitStatus >= 0">
in_hospit_status = #{inHospitStatus,jdbcType=INTEGER},
</if>
<if test="inHospitResult != null and inHospitResult >= 0">
in_hospit_result = #{inHospitResult,jdbcType=INTEGER},
</if>
<if test="inHospitDoctor != null and inHospitDoctor != ''">
in_hospit_doctor = #{inHospitDoctor,jdbcType=VARCHAR},
</if>
<if test="inHospitDate != null">
in_hospit_date = #{inHospitDate,jdbcType=TIMESTAMP},
</if>
<if test="inHospitMakeDate != null">
in_hospit_make_date = #{inHospitMakeDate,jdbcType=TIMESTAMP},
</if>
<if test="inHospitRemark != null and inHospitRemark != ''">
in_hospit_remark = #{inHospitRemark,jdbcType=VARCHAR},
</if>
<if test="inHospitFailure != null and inHospitFailure >= 0">
in_hospit_failure = #{inHospitFailure,jdbcType=INTEGER},
</if>
<if test="makeInHospitDate != null">
make_in_hospit_date = #{makeInHospitDate,jdbcType=TIMESTAMP},
</if>
<if test="makeDate != null">
make_date = #{makeDate,jdbcType=TIMESTAMP},
</if>
<if test="makeDoctor != null and makeDoctor != ''">
make_doctor = #{makeDoctor,jdbcType=VARCHAR},
</if>
<if test="makeRemark != null and makeRemark != ''">
make_remark = #{makeRemark,jdbcType=VARCHAR},
</if>
<if test="hospitalId != null and hospitalId != ''">
hospital_id = #{hospitalId,jdbcType=VARCHAR},
</if>
<if test="hospitStatus != null and hospitStatus >= 0">
hospit_status = #{hospitStatus,jdbcType=INTEGER},
</if>
<if test="hospitDate != null">
hospit_date = #{hospitDate,jdbcType=TIMESTAMP},
</if>
<if test="hospitType != null">
hospit_type = #{hospitType,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>


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


<select id="getPatientMarkHospital" resultMap="PatientMarkHospitalResultMap" parameterType="java.lang.String">
select id,patient_id,pid,back_status,back_result,back_doctor,back_date,back_make_date,back_remark,back_failure,in_hospit_status,in_hospit_result,in_hospit_doctor,in_hospit_date,in_hospit_make_date,in_hospit_remark,in_hospit_failure,make_in_hospit_date,make_date,make_doctor,make_remark,hospital_id,hospit_status,hospit_date,hospit_type
from patient_mark_hospital 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="PatientMarkHospitalCondition">
<where>
1 = 1
<if test="id != null and id != ''">
and id = #{id,jdbcType=VARCHAR}
</if>
<if test="patientId != null and patientId != ''">
and patient_id = #{patientId,jdbcType=VARCHAR}
</if>
<if test="patientIds!=null">
and parentid in (
<foreach item="patientId" collection="patientIds" separator=",">
#{patientId}
</foreach>
)
</if>
<if test="pid != null and pid != ''">
and pid = #{pid,jdbcType=VARCHAR}
</if>
<if test="backStatus != null and backStatus >= 0">
and back_status = #{backStatus,jdbcType=INTEGER}
</if>
<if test="backResult != null and backResult >= 0">
and back_result = #{backResult,jdbcType=INTEGER}
</if>
<if test="backDoctor != null and backDoctor != ''">
and back_doctor = #{backDoctor,jdbcType=VARCHAR}
</if>
<if test="backDate != null">
and back_date = #{backDate,jdbcType=TIMESTAMP}
</if>
<if test="backMakeDate != null">
and back_make_date = #{backMakeDate,jdbcType=TIMESTAMP}
</if>
<if test="backRemark != null and backRemark != ''">
and back_remark = #{backRemark,jdbcType=VARCHAR}
</if>
<if test="backFailure != null and backFailure >= 0">
and back_failure = #{backFailure,jdbcType=INTEGER}
</if>
<if test="inHospitStatus != null and inHospitStatus >= 0">
and in_hospit_status = #{inHospitStatus,jdbcType=INTEGER}
</if>
<if test="inHospitResult != null and inHospitResult >= 0">
and in_hospit_result = #{inHospitResult,jdbcType=INTEGER}
</if>
<if test="inHospitDoctor != null and inHospitDoctor != ''">
and in_hospit_doctor = #{inHospitDoctor,jdbcType=VARCHAR}
</if>
<if test="inHospitDate != null">
and in_hospit_date = #{inHospitDate,jdbcType=TIMESTAMP}
</if>
<if test="inHospitMakeDate != null">
and in_hospit_make_date = #{inHospitMakeDate,jdbcType=TIMESTAMP}
</if>
<if test="inHospitRemark != null and inHospitRemark != ''">
and in_hospit_remark = #{inHospitRemark,jdbcType=VARCHAR}
</if>
<if test="inHospitFailure != null and inHospitFailure >= 0">
and in_hospit_failure = #{inHospitFailure,jdbcType=INTEGER}
</if>
<if test="makeInHospitDate != null">
and make_in_hospit_date = #{makeInHospitDate,jdbcType=TIMESTAMP}
</if>
<if test="makeDate != null">
and make_date = #{makeDate,jdbcType=TIMESTAMP}
</if>
<if test="makeStartDate != null">
AND
<![CDATA[
DATEDIFF(#{makeStartDate},make_date)<=0
]]>
</if>
<if test="makeEndDate != null">
AND
<![CDATA[
DATEDIFF(#{makeEndDate},make_date)>=0
]]>
</if>
<if test="makeDoctor != null and makeDoctor != ''">
and make_doctor = #{makeDoctor,jdbcType=VARCHAR}
</if>
<if test="makeRemark != null and makeRemark != ''">
and make_remark = #{makeRemark,jdbcType=VARCHAR}
</if>
<if test="hospitalId != null and hospitalId != ''">
and hospital_id = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="hospitStatus != null and hospitStatus >= 0">
and hospit_status = #{hospitStatus,jdbcType=INTEGER}
</if>
<if test="hospitDate != null">
and hospit_date = #{hospitDate,jdbcType=TIMESTAMP}
</if>
</where>
</sql>


<select id="queryPatientMarkHospital" resultMap="PatientMarkHospitalResultMap"
parameterType="com.lyms.platform.permission.model.PatientMarkHospitalQuery">
select
id,patient_id,pid,back_status,back_result,back_doctor,back_date,back_make_date,back_remark,back_failure,in_hospit_status,in_hospit_result,in_hospit_doctor,in_hospit_date,in_hospit_make_date,in_hospit_remark,in_hospit_failure,make_in_hospit_date,make_date,make_doctor,make_remark,hospital_id,hospit_status,hospit_date
from patient_mark_hospital
<include refid="PatientMarkHospitalCondition"/>
<include refid="orderAndLimit"/>
</select>


<select id="queryPatientMarkHospitalCount" resultType="int"
parameterType="com.lyms.platform.permission.model.PatientMarkHospitalQuery">
select count(1) from patient_mark_hospital
<include refid="PatientMarkHospitalCondition"/>
</select>


</mapper>