优化已打印查询

master
zengwh 3 years ago
parent ff7eb8501f
commit fedd5240da

@ -130,7 +130,7 @@ public class Archive_MasterServiceImpl implements Archive_MasterService {
@Override
public List<Archive_Master_Vo> selectByLastByColumn(Archive_Master_Vo archiveMasterVo,Integer offset, Integer limit) {
//判断并设置查询是否打印权限
setIdByPrintNum(archiveMasterVo);
//setIdByPrintNum(archiveMasterVo);
//根据条件查询记录
if(null != offset && null != limit) {
PageHelper.offsetPage(offset, limit);
@ -174,7 +174,7 @@ public class Archive_MasterServiceImpl implements Archive_MasterService {
@Override
public List<Archive_Master_Vo> selectBeHospitalByColumn(Archive_Master_Vo archiveMasterVo, Integer offset, Integer limit) {
//判断并设置查询是否打印权限
setIdByPrintNum(archiveMasterVo);
//setIdByPrintNum(archiveMasterVo);
//根据条件查询记录
if(null != offset && null != limit) {
PageHelper.offsetPage(offset, limit);
@ -308,7 +308,7 @@ public class Archive_MasterServiceImpl implements Archive_MasterService {
@Override
public List<Archive_Master_Vo> selectByUnfileAndColumn(Archive_Master_Vo archiveMasterVo,Integer offset, Integer limit) {
//判断并设置查询是否打印权限
setIdByPrintNum(archiveMasterVo);
//setIdByPrintNum(archiveMasterVo);
//根据条件查询记录
if(null != offset && null != limit) {
PageHelper.offsetPage(offset, limit);
@ -576,7 +576,7 @@ public class Archive_MasterServiceImpl implements Archive_MasterService {
@Override
public List<Archive_Master_Vo> selectByCmtByColumn(Archive_Master_Vo archiveMasterVo, Integer offset, Integer limit) {
//判断并设置查询是否打印权限
setIdByPrintNum(archiveMasterVo);
//setIdByPrintNum(archiveMasterVo);
//根据条件查询记录
if(null != offset && null != limit) {
PageHelper.offsetPage(offset, limit);

@ -297,6 +297,8 @@
LEFT JOIN (select zyh,jzh,COUNT(*) num from archive_other_ext where T2!='1801-02-03 00:00:00.000' group by zyh,jzh) extNurse
on m.inp_no=extNurse.zyh
and m.visit_id=extNurse.jzh
LEFT JOIN (select MasterID,COUNT(*) num from archive_printInfo group by MasterID) printTable
on m.id=printTable.MasterID
where 1=1 and ArchiveState in('归档中','提交','主任退回') and m.Is_Valid!=1
and patindex('%B%',m.inp_no) = 0 and inp_no not like 'LG%'
<if test="emrCmit!=null and emrCmit!=''">
@ -308,18 +310,12 @@
</if>
</if>
<if test="printNum != null and printNum != ''">
and m.id
<choose>
<when test="printNum == 1">
in
and printTable.MasterID is not null
</when>
<otherwise>not in</otherwise>
<otherwise>and printTable.MasterID is null</otherwise>
</choose>
(
<foreach collection="id.split(',')" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="inpNo != null and inpNo != ''">
and m.inp_no like '%'+#{inpNo,jdbcType=NCHAR}+'%'
@ -434,18 +430,12 @@
where 1=1 and ArchiveState in('初审') and m.Is_Valid!=1
and patindex('%B%',m.inp_no) = 0 and inp_no not like 'LG%'
<if test="printNum != null and printNum != ''">
and m.id
<choose>
<when test="printNum == 1">
in
and printTable.MasterID is not null
</when>
<otherwise>not in</otherwise>
<otherwise>and printTable.MasterID is null</otherwise>
</choose>
(
<foreach collection="id.split(',')" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="inpNo != null and inpNo != ''">
and m.inp_no like '%'+#{inpNo,jdbcType=NCHAR}+'%'
@ -708,18 +698,12 @@
and patindex('%B%',m.inp_no) in (0,1)
and m.ArchiveState not in('作废','已封存') and m.Is_Valid!=1 and inp_no not like 'LG%'
<if test="printNum != null and printNum != ''">
and m.id
<choose>
<when test="printNum == 1">
in
and printTable.MasterID is not null
</when>
<otherwise>not in</otherwise>
<otherwise>and printTable.MasterID is null</otherwise>
</choose>
(
<foreach collection="id.split(',')" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="inpNo != null and inpNo != ''">
and m.inp_no like '%'+#{inpNo,jdbcType=NCHAR}+'%'
@ -848,18 +832,12 @@
where 1=1 and ArchiveState in('提交','主任退回','归档中','复审退回')
and patindex('%B%',m.inp_no) = 0 and inp_no not like 'LG%' and m.Is_Valid!=1
<if test="printNum != null and printNum != ''">
and m.id
<choose>
<when test="printNum == 1">
in
and printTable.MasterID is not null
</when>
<otherwise>not in</otherwise>
<otherwise>and printTable.MasterID is null</otherwise>
</choose>
(
<foreach collection="id.split(',')" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="inpNo != null and inpNo != ''">
and m.inp_no like '%'+#{inpNo,jdbcType=NCHAR}+'%'

Loading…
Cancel
Save