Plat.xml 10.4 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
<?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="PlatMapper">

<resultMap id="PlatDataTypeResultMap" type="com.lymsh.mommybaby.earlydata.model.PlatDataType">
<result column="DT_ID" property="dtId" jdbcType="VARCHAR"/>
<result column="DT_NAME" property="dtName" jdbcType="VARCHAR"/>
</resultMap>

<sql id="PlatDataTypeColumns">
DT_ID,DT_NAME
</sql>

<select id="selectPlatDataType" resultMap="PlatDataTypeResultMap">
select
<include refid="PlatDataTypeColumns"/>
from PLAT_DATATYPE
</select>




<resultMap id="PlatDataContentResultMap" type="com.lymsh.mommybaby.earlydata.model.PlatDataContent">
<result column="DC_ID" property="dcId" jdbcType="VARCHAR"/>
<result column="DC_NAME" property="dcName" jdbcType="VARCHAR"/>
<result column="DC_NO" property="dcNo" jdbcType="VARCHAR"/>
<result column="DC_PARENTID" property="dcParentid" jdbcType="VARCHAR"/>
<result column="DC_DATATYPEID" property="dcDatatypeid" jdbcType="VARCHAR"/>
</resultMap>

<sql id="PlatDataContentColumns">
DC_ID,DC_NAME,DC_PARENTID,DC_DATATYPEID,DC_NO
</sql>

<select id="selectPlatDataContent" resultMap="PlatDataContentResultMap">
select
<include refid="PlatDataContentColumns"/>
from PLAT_DATACONTENT
</select>



<resultMap id="PlatHospitalResultMap" type="com.lymsh.mommybaby.earlydata.model.PlatHospital">
<result column="H_ID" property="hId" jdbcType="VARCHAR"/>
<result column="H_NAME" property="hName" jdbcType="VARCHAR"/>
</resultMap>

<sql id="PlatHospitalColumns">
H_ID,H_NAME
</sql>

<select id="selectPlatHospital" resultMap="PlatHospitalResultMap" parameterType="com.lymsh.mommybaby.earlydata.model.OracleCommonQuery">
select
<include refid="PlatHospitalColumns"/>
from (select<include refid="PlatHospitalColumns"/>,rownum r
from (
select
<include refid="PlatHospitalColumns"/>
from PLAT_HOSPITAL t
) h where
<![CDATA[ rownum <= #{endRow} ]]>
)
where
<![CDATA[ r >= #{startRow} ]]>
</select>



<resultMap id="PlatUsersResultMap" type="com.lymsh.mommybaby.earlydata.model.PlatUsers">
<result column="U_ID" property="uId" jdbcType="VARCHAR"/>
<result column="U_USERNAME" property="uUsername" jdbcType="VARCHAR"/>
<result column="U_USERPWD" property="uUserpwd" jdbcType="VARCHAR"/>
<result column="U_EMPLOYEEID" property="uEmployeeid" jdbcType="VARCHAR"/>
<result column="U_LOGINNUM" property="uLoginnum" jdbcType="VARCHAR"/>
<result column="U_ISVALID" property="uIsvalid" jdbcType="INTEGER"/>
</resultMap>

<sql id="PlatUsersColumns">
U_ID,U_USERNAME,U_USERPWD,U_EMPLOYEEID,U_LOGINNUM,U_ISVALID
</sql>

<select id="selectPlatUsers" resultMap="PlatUsersResultMap" parameterType="com.lymsh.mommybaby.earlydata.model.OracleCommonQuery">
select
<include refid="PlatUsersColumns"/>
from (select<include refid="PlatUsersColumns"/>,rownum r
from (
select
<include refid="PlatUsersColumns"/>
from PLAT_USERS t
where U_OPERTIME >= #{startTime}
) h where
<![CDATA[ rownum <= #{endRow} ]]>
)
where
<![CDATA[ r >= #{startRow} ]]>
</select>



<resultMap id="PlatPatientResultMap" type="com.lymsh.mommybaby.earlydata.model.PlatPatient">
<result column="P_ID" property="pId" jdbcType="VARCHAR"/>
<result column="P_NAME" property="pName" jdbcType="VARCHAR"/>
<result column="P_SEX" property="pSex" jdbcType="INTEGER"/>
<result column="P_ISVALID" property="pIsvalid" jdbcType="INTEGER"/>
<result column="P_BIRTHDAY" property="pBirthday" jdbcType="TIMESTAMP"/>
<result column="P_MOBILEPHONE" property="pMobilephone" jdbcType="VARCHAR"/>
</resultMap>

<sql id="PlatPatientColumns">
P_ID,P_NAME,P_SEX,P_BIRTHDAY,P_MOBILEPHONE,P_ISVALID
</sql>

<select id="selectPlatPatient" resultMap="PlatPatientResultMap" parameterType="com.lymsh.mommybaby.earlydata.model.OracleCommonQuery">
select
<include refid="PlatPatientColumns"/>
from (select<include refid="PlatPatientColumns"/>,rownum r
from (
select
<include refid="PlatPatientColumns"/>
from PLAT_PATIENT t
where P_OPERTIME >= #{startTime}
) h where
<![CDATA[ rownum <= #{endRow} ]]>
)
where
<![CDATA[ r >= #{startRow} ]]>
</select>

<select id="selectTable" resultType="hashmap" parameterType="com.lymsh.mommybaby.earlydata.model.OracleCommonQuery">
select
*
from (select h.* ,rownum r
from (
select
t.*
from ${tableName} t
where ${timeColumnName} >= #{startTime} <if test="condition != null and condition != ''"> and ${condition} </if>
) h where
<![CDATA[ rownum <= #{endRow} ]]>
)
where
<![CDATA[ r >= #{startRow} ]]>
</select>

<select id="selectAllByHospitalId" resultType="hashmap" parameterType="map">
select
pp.P_ID,pp.P_NAME,pp.P_SEX,pp.P_BIRTHDAY,pp.P_MOBILEPHONE,pp.P_ISVALID, mp.P_NO,mp.P_OPERUSER,mp.P_TYPE,mp.P_PLATPATIENTID,mp.P_LASTMENSTRUALPERIOD,mp.P_ISVALID,mp.P_SERVICETYPE,mp.P_ISVIP,mp.P_FILINGOPER,
vp.DC_NAME as V_DC_NAME,vp.ME_COLORNAME as V_ME_COLORNAME,vp.FENSHU as V_FENSHU,vp.PI_AGEMONTH,first.*,result.*,pd.dc_name,pd.dc_no,me.me_colorname

from plat_patient pp left join mommy_patient mp on pp.p_id = mp.p_platpatientid left join V_GETALLPATIENT vp on pp.p_id = vp.P_PLATPATIENTID
left join MOMMY_FIRSTEXAMINE first on first.fe_triageorderno = mp.P_NO left join MOMMY_EXAMINERESULT result on result.er_triageorderno = mp.P_NO left join MOMMY_EXAMINWARNING me on (me.me_examinid = first.fe_id or me.me_examinid = result.er_id)
left join PLAT_DATACONTENT pd on me.ME_WORNINGID = pd.DC_Id
where mp.p_hospitalid = #{hospitalId}
<if test="startTime != null">
and (mp.p_opertime >= #{startTime} or first.fe_opertime >= #{startTime} or result.er_opertime >= #{startTime} )
</if>
order by pp.p_id,first.fe_id,result.er_id
</select>


<resultMap id="ViewPatientResultMap" type="com.lymsh.mommybaby.earlydata.model.ViewPatient">
<result column="DC_NAME" property="dcName" jdbcType="VARCHAR"/>
<result column="ME_COLORNAME" property="meColorname" jdbcType="VARCHAR"/>
<result column="PI_AGEMONTH" property="ageMonth" jdbcType="VARCHAR"/>
<result column="FENSHU" property="fenshu" jdbcType="INTEGER"/>
</resultMap>


<select id="selectViewPatient" resultMap="ViewPatientResultMap" parameterType="java.lang.String">
select DC_NAME,ME_COLORNAME,FENSHU,PI_AGEMONTH FROM V_GETALLPATIENT WHERE P_PLATPATIENTID = #{patientId}
</select>

<resultMap id="RiskDetailsResultMap" type="com.lymsh.mommybaby.earlydata.model.ViewPatient">
<result column="DC_NAME" property="dcName" jdbcType="VARCHAR"/>
<result column="ME_COLORNAME" property="meColorname" jdbcType="VARCHAR"/>
<result column="FENSHU" property="fenshu" jdbcType="INTEGER"/>
</resultMap>

<select id="selectRiskDetails" resultMap="RiskDetailsResultMap" parameterType="java.lang.String">
SELECT pd.dc_name as DC_NAME,pd.dc_no as FENSHU,me.me_colorname as ME_COLORNAME FROM MOMMY_EXAMINWARNING ME
LEFT JOIN PLAT_DATACONTENT PD
ON ME.ME_WORNINGID = PD.DC_ID where me.me_examinid = #{examineId}
</select>

<select id="selectOtherRiskDetails" resultMap="RiskDetailsResultMap" parameterType="java.lang.String">
select id as ME_COLORNAME,mo_content as DC_NAME,mo_values as FENSHU from MOMMY_OTHERWORNING where id = #{examineId}
</select>

<select id="selectAllUserByHospitalId" resultType="hashmap" parameterType="map">
select
h.h_id,h.h_name,h.h_helpcode,h.h_introduce,h.h_servicesuffix,h.h_isvalid,h.h_operuser,h.h_des,h.h_provinceno,h.h_cityno,h.h_countyno,h.h_township,h.h_street,h.h_type,h.h_level,h.h_isleader,
d.*,
e.E_ID,e.E_NAME,e.E_SEX,e.E_HOSPITALID,e.E_JOBTITLEID,e.E_DEPTID ,
u.*,
wmsys.wm_concat(r.r_name) over (partition by u.u_id) ur_roleids

from plat_hospital h
left join mommy_dept d on h.h_id = d.d_hospitalid
left join mommy_employee e on e.e_deptid = d.d_id
left join plat_users u on u.u_employeeid = e.e_id
left join plat_userrole ur on ur.ur_userid = u.u_id and ur.ur_roleid is not null and ur.ur_isvalid =1
left join plat_role r on r.r_id = ur.ur_roleid

where u.u_id is not null and h.h_name is not null
<if test="hospitalId != null">
and h.h_id = #{hospitalId}
</if>
<if test="startTime != null">
and (u.u_opertime >= #{startTime} or e.e_opertime >= #{startTime} or d.d_opertime >= #{startTime} )
</if>
order by h.h_id,d.d_id,u.u_id
</select>

<select id="selectAllPuerperaByHospitalId" resultType="hashmap" parameterType="map">
select
ppt.*,mp.*,card.*
from
mommy_patient mp,plat_patient ppt, mommy_visitcard card
where
mp.p_platpatientid = ppt.p_id and card.vc_patientno = mp.p_no
and mp.p_hospitalid is not null and ppt.p_id is not null and mp.p_no is not null and ppt.p_name is not null and mp.P_MOBILEPHONE is not null
and ( floor((sysdate - P_LASTMENSTRUALPERIOD+1)/7) > 41 or ( SELECT COUNT(0) FROM mommy_pregDeliveryrecord pp WHERE pp.PDR_PATIENTID =mp.p_platpatientid)>0 )
<if test="hospitalId != null">
and mp.p_hospitalid = #{hospitalId}
</if>
<if test="startTime != null">
and (mp.p_opertime >= #{startTime} or ppt.p_opertime >= #{startTime} or card.vc_opertime >= #{startTime} )
</if>
order by mp.p_hospitalid,ppt.p_id,mp.p_no
</select>

<select id="selectMommyRefer" resultType="hashmap" parameterType="map">
select *
from MOMMY_REFERENCE
where MR_HOSPITAL = #{hospitalId} and MR_UNIT is not null and MR_MAXVALUE is not null and MR_MINVALUE is not null and MR_CTRLNAME is not null and MR_CTRLID is null and MR_CODE is not null
order by MR_CTRLID
</select>


</mapper>