|
@@ -63,7 +63,7 @@
|
|
r.PATIENT_ID,
|
|
r.PATIENT_ID,
|
|
r.REC_NAME,
|
|
r.REC_NAME,
|
|
case r.REC_GENDER when 'F' then '女' when 'M' then '男' end REC_GENDER,
|
|
case r.REC_GENDER when 'F' then '女' when 'M' then '男' end REC_GENDER,
|
|
- concat(r.REC_AGE1, r.REC_AGEUNIT1, r.REC_AGE2, r.REC_AGEUNIT2) REC_AGE,
|
|
|
|
|
|
+ CONCAT_WS('', r.REC_AGE1, r.REC_AGEUNIT1, r.REC_AGE2, r.REC_AGEUNIT2) REC_AGE,
|
|
date_format(p.PRE_TIME, '%Y-%m-%d %H:%i:%s') PRE_TIME,
|
|
date_format(p.PRE_TIME, '%Y-%m-%d %H:%i:%s') PRE_TIME,
|
|
p.REC_ID,
|
|
p.REC_ID,
|
|
p.PRE_ID,
|
|
p.PRE_ID,
|
|
@@ -96,13 +96,13 @@
|
|
when '4' then '适宜技术方'
|
|
when '4' then '适宜技术方'
|
|
when '5' then '制剂'
|
|
when '5' then '制剂'
|
|
end PRE_TYPE,
|
|
end PRE_TYPE,
|
|
-<!-- p.PRE_MAT_TYPE,-->
|
|
|
|
|
|
+ p.PRE_MAT_TYPE,
|
|
p.STORE_ID,
|
|
p.STORE_ID,
|
|
(select DISPLAY_NAME from t_display d where d.STORE_ID = p.STORE_ID limit 1) STORE_NAME,
|
|
(select DISPLAY_NAME from t_display d where d.STORE_ID = p.STORE_ID limit 1) STORE_NAME,
|
|
case r.REC_TRE_TYPE when '1' then '门诊' when '2' then '住院' end REC_TRE_TYPE,
|
|
case r.REC_TRE_TYPE when '1' then '门诊' when '2' then '住院' end REC_TRE_TYPE,
|
|
CASE p.PRE_TYPE
|
|
CASE p.PRE_TYPE
|
|
- WHEN '1' THEN CONCAT(p.PRE_DESCRIPTION, ',', PRE_FREQUENCY, ',每次', PRE_N_ML, 'ml')
|
|
|
|
- WHEN '2' THEN CONCAT(p.PRE_SMOKE_TYPE, ',', PRE_FREQUENCY, ',每袋', PRE_N_ML, 'ml')
|
|
|
|
|
|
+ WHEN '1' THEN CONCAT_WS(',', p.PRE_DESCRIPTION, PRE_FREQUENCY, CONCAT('每次', PRE_N_ML, 'ml'))
|
|
|
|
+ WHEN '2' THEN CONCAT_WS(',', p.PRE_SMOKE_TYPE, PRE_FREQUENCY, CONCAT('每袋', PRE_N_ML, 'ml'))
|
|
END PRE_DESCRIPTION,
|
|
END PRE_DESCRIPTION,
|
|
p.PRE_NUM,
|
|
p.PRE_NUM,
|
|
p.MAT_TOL_MONEY,
|
|
p.MAT_TOL_MONEY,
|
|
@@ -111,7 +111,7 @@
|
|
i.MAT_DOSE,
|
|
i.MAT_DOSE,
|
|
i.BZDW_HIS,
|
|
i.BZDW_HIS,
|
|
i.YFMC_HIS,
|
|
i.YFMC_HIS,
|
|
- GROUP_CONCAT(i.YPMC_HIS, 0+CAST(i.MAT_DOSE AS CHAR), i.BZDW_HIS, IF(i.YFMC_HIS=NULL OR i.YFMC_HIS='', '', CONCAT('(',i.YFMC_HIS,')'))) mats
|
|
|
|
|
|
+ GROUP_CONCAT(CONCAT_WS('', i.YPMC_HIS, 0+CAST(i.MAT_DOSE AS CHAR), i.BZDW_HIS, CONCAT('(',i.YFMC_HIS,')'))) mats
|
|
|
|
|
|
from t_prescription p
|
|
from t_prescription p
|
|
left join t_record r on r.REC_ID = p.REC_ID
|
|
left join t_record r on r.REC_ID = p.REC_ID
|
|
@@ -119,6 +119,7 @@
|
|
left join t_prescription_item i on i.PRE_ID = p.PRE_ID
|
|
left join t_prescription_item i on i.PRE_ID = p.PRE_ID
|
|
<include refid="detailedWhere"/>
|
|
<include refid="detailedWhere"/>
|
|
GROUP BY p.PRE_ID
|
|
GROUP BY p.PRE_ID
|
|
|
|
+ order by p.pre_time
|
|
<if test="limit != null">
|
|
<if test="limit != null">
|
|
limit #{offset}, #{limit}
|
|
limit #{offset}, #{limit}
|
|
</if>
|
|
</if>
|
|
@@ -126,7 +127,7 @@
|
|
|
|
|
|
<sql id="detailedWhere">
|
|
<sql id="detailedWhere">
|
|
<where>
|
|
<where>
|
|
- p.is_del = '0'
|
|
|
|
|
|
+ p.is_del = '0' and p.REC_EXT_TYPE >= 50 and p.REC_EXT_TYPE != 110
|
|
<if test="appId != null and appId != ''">
|
|
<if test="appId != null and appId != ''">
|
|
and r.APP_ID = #{appId}
|
|
and r.APP_ID = #{appId}
|
|
</if>
|
|
</if>
|
|
@@ -184,18 +185,12 @@
|
|
<if test="preOrigin != null and preOrigin != ''">
|
|
<if test="preOrigin != null and preOrigin != ''">
|
|
and p.PRE_ORIGIN = #{preOrigin}
|
|
and p.PRE_ORIGIN = #{preOrigin}
|
|
</if>
|
|
</if>
|
|
- <if test="preType != null and preType != ''">
|
|
|
|
- and locate(p.PRE_TYPE, #{preType}) > 0
|
|
|
|
- </if>
|
|
|
|
<if test="recTreType != null and recTreType != ''">
|
|
<if test="recTreType != null and recTreType != ''">
|
|
and r.REC_TRE_TYPE = #{recTreType}
|
|
and r.REC_TRE_TYPE = #{recTreType}
|
|
</if>
|
|
</if>
|
|
<if test="storeId != null and storeId != ''">
|
|
<if test="storeId != null and storeId != ''">
|
|
and p.STORE_ID = #{storeId}
|
|
and p.STORE_ID = #{storeId}
|
|
</if>
|
|
</if>
|
|
- <if test="preDescription != null and preDescription != ''">
|
|
|
|
- and p.PRE_DESCRIPTION like CONCAT('%', #{preDescription}, '%')
|
|
|
|
- </if>
|
|
|
|
<if test="preNumStart != null and preNumStart != ''">
|
|
<if test="preNumStart != null and preNumStart != ''">
|
|
and p.PRE_NUM >= #{preNumStart}
|
|
and p.PRE_NUM >= #{preNumStart}
|
|
</if>
|
|
</if>
|
|
@@ -220,6 +215,30 @@
|
|
or i.YFMC_HIS = #{mats}
|
|
or i.YFMC_HIS = #{mats}
|
|
)
|
|
)
|
|
</if>
|
|
</if>
|
|
|
|
+ <choose>
|
|
|
|
+ <when test="preType != null and preType == '1'.toString()">
|
|
|
|
+ and p.PRE_TYPE = '1'
|
|
|
|
+ <if test="preDescription != null and preDescription != ''">
|
|
|
|
+ and (p.PRE_DESCRIPTION like CONCAT('%', #{preDescription}, '%')
|
|
|
|
+ or p.PRE_FREQUENCY like CONCAT('%', #{preDescription}, '%'))
|
|
|
|
+ </if>
|
|
|
|
+ </when>
|
|
|
|
+ <when test="preType != null and preType == '2'.toString()">
|
|
|
|
+ and p.PRE_TYPE = '2'
|
|
|
|
+ <if test="preDescription != null and preDescription != ''">
|
|
|
|
+ and (p.PRE_SMOKE_TYPE like CONCAT('%', #{preDescription}, '%')
|
|
|
|
+ or p.PRE_FREQUENCY like CONCAT('%', #{preDescription}, '%'))
|
|
|
|
+ </if>
|
|
|
|
+ </when>
|
|
|
|
+ <otherwise>
|
|
|
|
+ and locate(p.PRE_TYPE, #{preType}) > 0
|
|
|
|
+ <if test="preDescription != null and preDescription != ''">
|
|
|
|
+ and (p.PRE_DESCRIPTION like CONCAT('%', #{preDescription}, '%')
|
|
|
|
+ or p.PRE_SMOKE_TYPE like CONCAT('%', #{preDescription}, '%')
|
|
|
|
+ or p.PRE_FREQUENCY like CONCAT('%', #{preDescription}, '%'))
|
|
|
|
+ </if>
|
|
|
|
+ </otherwise>
|
|
|
|
+ </choose>
|
|
</where>
|
|
</where>
|
|
</sql>
|
|
</sql>
|
|
</mapper>
|
|
</mapper>
|