,case when emr_fault_detail.archive_detail_id is not null then '是' else '否' end isFault,ISNULL(sDoctor.numb, 0) faultDoctorNum,ISNULL(sNurse.numb, 0) faultNurseNum,ISNULL(printTable.num, 0) printNum
from archive_master m
LEFT JOIN (select code,name from emr_dictionary where parent_id=(select id from emr_dictionary where
typeCode='dept_code' )) d
@ -416,6 +416,8 @@
on m.dept_name=f.code
LEFT JOIN(select archive_detail_id,count(*) numb from emr_fault_detail where 1=1 and back_flag in ('1','5') GROUP BY archive_detail_id) sDoctor
on m.id=sDoctor.archive_detail_id
left join (select distinct archive_detail_id from emr_fault_detail where back_flag in ('6','5')) emr_fault_detail
on emr_fault_detail.archive_detail_id = m.ID
LEFT JOIN(select archive_detail_id,count(*) numb from emr_fault_detail where 1=1 and back_flag in ('2','6') GROUP BY archive_detail_id) sNurse
on m.id=sNurse.archive_detail_id
left join Archive_Master_Following amf
@ -429,6 +431,14 @@
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%'
<iftest="isFault != null and isFault != ''">
<iftest="isFault == 1">
AND emr_fault_detail.archive_detail_id is not null