@ -433,95 +433,141 @@
</if>
</sql>
<select id= "getArchiveExtInfo" resultMap= "BaseResultMap" >
select temp.*,zd_assort.assort_name,zd_assort.assort_id,
archive_other_ext_submitTime.create_time,archive_other_ext_submitTime.str2 tempTime,
CASE
WHEN sysFlag = 1 THEN
CASE
WHEN archive_other_ext_submitTime.str2 IS NOT NULL
AND archive_other_ext_submitTime.str2 >= (select top 1 convert(varchar(19),eTime,120) eTime from archive_other_ext where sysFlag = 1 and jzh = temp.jzh order by eTime desc) THEN
- 1
ELSE
statusFlag
END
ELSE
CASE
WHEN archive_other_ext_submitTime.str2 IS NOT NULL
AND archive_other_ext_submitTime.str2 >= etimeStr THEN
- 1
ELSE
statusFlag
END
END
statusFlagSort
from (
select
archive_other_ext.ID idTemp,
SycTime,
sysFlag,
CONVERT(varchar(19),sysUpdateTime,120) sysupdatetimeStr,
CONVERT(varchar(19),stime,120) stimeStr,
CONVERT(varchar(19),eTime,120) etimeStr,
statusFlag,
pResult,
C1,
DID,
jzh
from archive_other_ext
<where >
C1 != '一般病程记录' and sysFlag != 5
<include refid= "selectWhereSql" > </include>
</where>
union all
select
top 1
archive_other_ext.ID idTemp,
SycTime,
sysFlag,
CONVERT(varchar(19),sysUpdateTime,120) sysupdatetimeStr,
CONVERT(varchar(19),stime,120) stimeStr,
CONVERT(varchar(19),eTime,120) etimeStr,
statusFlag,
pResult,
'手麻系统病历' as C1,
DID,
jzh
from archive_other_ext
<where >
and sysFlag = 5 /*and (C1 = '术前访视' or C1 = '术后访视' or C1 = '麻醉记录' or C1 = '麻醉小结')*/
<include refid= "selectWhereSql" > </include>
</where>
union all
select
top 1
archive_other_ext.ID idTemp,
SycTime,
sysFlag,
CONVERT(varchar(19),sysUpdateTime,120) sysupdatetimeStr,
CONVERT(varchar(19),stime,120) stimeStr,
CONVERT(varchar(19),eTime,120) etimeStr,
statusFlag,
pResult,
C1,
DID,
jzh
from archive_other_ext
<where >
C1 = '一般病程记录'
<include refid= "selectWhereSql" > </include>
</where>
order by sysUpdateTime desc
) temp
LEFT JOIN archive_detail ON temp.DID = archive_detail.id
LEFT JOIN zd_assort ON archive_detail.AssortID = zd_assort.assort_id
LEFT JOIN archive_other_ext_submitTime
ON archive_other_ext_submitTime.other_ext_id = temp.idTemp
<where >
<if test= "assortId != null and assortId != ''" >
and zd_assort.assort_id = #{assortId,jdbcType=NVARCHAR}
</if>
</where>
order by statusFlagSort
<!-- select temp.*,zd_assort.assort_name,zd_assort.assort_id, -->
<!-- archive_other_ext_submitTime.create_time,archive_other_ext_submitTime.str2 tempTime, -->
<!-- CASE -->
<!-- WHEN sysFlag = 1 THEN -->
<!-- CASE -->
<!-- WHEN archive_other_ext_submitTime.str2 IS NOT NULL -->
<!-- AND archive_other_ext_submitTime.str2 >= (select top 1 convert(varchar(19),eTime,120) eTime from archive_other_ext where sysFlag = 1 and jzh = temp.jzh order by eTime desc) THEN -->
<!-- - 1 -->
<!-- ELSE -->
<!-- statusFlag -->
<!-- END -->
<!-- ELSE -->
<!-- CASE -->
<!-- WHEN archive_other_ext_submitTime.str2 IS NOT NULL -->
<!-- AND archive_other_ext_submitTime.str2 >= etimeStr THEN -->
<!-- - 1 -->
<!-- ELSE -->
<!-- statusFlag -->
<!-- END -->
<!-- END -->
<!-- statusFlagSort -->
<!-- from ( -->
<!-- select -->
<!-- archive_other_ext.ID idTemp, -->
<!-- SycTime, -->
<!-- sysFlag, -->
<!-- CONVERT(varchar(19),sysUpdateTime,120) sysupdatetimeStr, -->
<!-- CONVERT(varchar(19),stime,120) stimeStr, -->
<!-- CONVERT(varchar(19),eTime,120) etimeStr, -->
<!-- statusFlag, -->
<!-- pResult, -->
<!-- C1, -->
<!-- DID, -->
<!-- jzh -->
<!-- from archive_other_ext -->
<!-- <where> -->
<!-- C1 != '一般病程记录' and sysFlag != 5 -->
<!-- <include refid="selectWhereSql"></include> -->
<!-- </where> -->
<!-- union all -->
<!-- select -->
<!-- top 1 -->
<!-- archive_other_ext.ID idTemp, -->
<!-- SycTime, -->
<!-- sysFlag, -->
<!-- CONVERT(varchar(19),sysUpdateTime,120) sysupdatetimeStr, -->
<!-- CONVERT(varchar(19),stime,120) stimeStr, -->
<!-- CONVERT(varchar(19),eTime,120) etimeStr, -->
<!-- statusFlag, -->
<!-- pResult, -->
<!-- '手麻系统病历' as C1, -->
<!-- DID, -->
<!-- jzh -->
<!-- from archive_other_ext -->
<!-- <where> -->
<!-- and sysFlag = 5 /*and (C1 = '术前访视' or C1 = '术后访视' or C1 = '麻醉记录' or C1 = '麻醉小结')*/ -->
<!-- <include refid="selectWhereSql"></include> -->
<!-- </where> -->
<!-- union all -->
<!-- select -->
<!-- top 1 -->
<!-- archive_other_ext.ID idTemp, -->
<!-- SycTime, -->
<!-- sysFlag, -->
<!-- CONVERT(varchar(19),sysUpdateTime,120) sysupdatetimeStr, -->
<!-- CONVERT(varchar(19),stime,120) stimeStr, -->
<!-- CONVERT(varchar(19),eTime,120) etimeStr, -->
<!-- statusFlag, -->
<!-- pResult, -->
<!-- C1, -->
<!-- DID, -->
<!-- jzh -->
<!-- from archive_other_ext -->
<!-- <where> -->
<!-- C1 = '一般病程记录' -->
<!-- <include refid="selectWhereSql"></include> -->
<!-- </where> -->
<!-- order by sysUpdateTime desc -->
<!-- ) temp -->
<!-- LEFT JOIN archive_detail ON temp.DID = archive_detail.id -->
<!-- LEFT JOIN zd_assort ON archive_detail.AssortID = zd_assort.assort_id -->
<!-- LEFT JOIN archive_other_ext_submitTime -->
<!-- ON archive_other_ext_submitTime.other_ext_id = temp.idTemp -->
<!-- <where> -->
<!-- <if test="assortId != null and assortId != ''"> -->
<!-- and zd_assort.assort_id = #{assortId,jdbcType=NVARCHAR} -->
<!-- </if> -->
<!-- </where> -->
<!-- order by statusFlagSort -->
select
archive_other_ext.ID idTemp,
archive_other_ext_submitTime.create_time,
archive_other_ext_submitTime.str2 tempTime,
SycTime,
sysFlag,
zd_assort.assort_name,
zd_assort.assort_id,
CONVERT(varchar(19),sysUpdateTime,120) sysupdatetimeStr,
CONVERT(varchar(19),stime,120) stimeStr,
CONVERT(varchar(19),eTime,120) etimeStr,
statusFlag,
pResult,
archive_other_ext.C2,
DID,
jzh,
CASE
WHEN sysFlag = 1 THEN
CASE
WHEN archive_other_ext_submitTime.str2 IS NOT NULL
AND archive_other_ext_submitTime.str2 >= (select top 1 convert(varchar(19),eTime,120) eTime from archive_other_ext where sysFlag = 1 and jzh = archive_other_ext.jzh order by eTime desc) THEN
- 1
ELSE
statusFlag
END
ELSE
CASE
WHEN archive_other_ext_submitTime.str2 IS NOT NULL
AND archive_other_ext_submitTime.str2 >= CONVERT(varchar(19),eTime,120) THEN
- 1
ELSE
statusFlag
END
END
statusFlagSort
from
archive_other_ext
LEFT JOIN archive_other_ext_submitTime ON archive_other_ext_submitTime.other_ext_id=archive_other_ext.MID
LEFT JOIN archive_detail ON archive_other_ext.DID = archive_detail.id
LEFT JOIN zd_assort ON archive_detail.AssortID = zd_assort.assort_id
<where >
<if test= "assortId != null and assortId != ''" >
and zd_assort.assort_id = #{assortId,jdbcType=NVARCHAR}
</if>
</where>
order by statusFlagSort
</select>
<select id= "selectAllByIds" resultMap= "BaseResultMap" >
select *,
@ -531,7 +577,7 @@
<!-- 批量更新statusFlag = 0 -->
<update id= "updateSubmit" >
update archive_other_ext
set statusFlag = 0,T 2 = '1801-02-03'
set statusFlag = 2
<where >
<if test= "ids != null and ids != ''" >
ID in (${ids})
@ -743,7 +789,16 @@
AND sysFlag = - 300
<include refid= "disDateRangeWhereSql" > </include>
</select>
<!-- 出院日期范围的功能查询语句 -->
<select id= "SuccessByExtIds1" resultType= "java.lang.Integer" parameterType= "java.lang.Integer" >
select count(*)
from archive_other_ext
where id in (${ids})
and statusFlag =2 AND statusFlag !=0
</select>
<!-- 出院日期范围的功能查询语句 -->
<sql id= "disDateRangeWhereSql" >
<choose >
<when test= "startDateTo != null and startDateTo != '' and endDateTo != null and endDateTo != ''" >