from Archive_Master_Following where 1=1 and following_type='5') as t1 where 1=1 and RowNum = 1
) f
LEFT JOIN (
select id master_id,patient_id,inp_no,visit_id,name,dept_name,convert(varchar,discharge_date_time,120) discharge_date_time,check_doctor,first_instance,DOCTOR_IN_CHARGE,death_flag,dept_admission_to,convert(varchar,admission_date_time,120) admission_date_time from archive_master where archiveState!='作废'
select id master_id,patient_id,inp_no,visit_id,name,dept_name,convert(varchar,discharge_date_time,120) discharge_date_time,check_doctor,first_instance,DOCTOR_IN_CHARGE,death_flag,dept_admission_to,convert(varchar,admission_date_time,120) admission_date_time
from archive_master where 1=1 and ArchiveState!='作废' and ArchiveState!='已封存' and Is_Valid!=1
) m
on f.master_id=m.master_id
LEFT JOIN (select code,name from emr_dictionary where parent_id=(select id from emr_dictionary where typeCode='dept_code' )) c
@ -1437,7 +1438,7 @@
LEFT JOIN (select code,name from emr_dictionary where parent_id=(select id from emr_dictionary where typeCode='dept_code' )) e
on m.dept_admission_to=e.code
<where> 1=1 and m.master_id!=''
<where> 1=1 and m.master_id!='' and m.master_id is not null
<iftest="(overdueDaysTwo != null and overdueDaysTwo != '') and (overdueDays != null and overdueDays != '')">
and ISNULL(dbo.f_WorkDay(DATEADD(DAY,1,CONVERT(VARCHAR(10),m.discharge_date_time,23)),f.handle_time) , 0)-#{overdueDays,jdbcType=NCHAR}>=#{overdueDaysTwo,jdbcType=NCHAR}
</if>
@ -1519,7 +1520,8 @@
)f2
on f1.master_id=f2.master_id and f1.rowNumb=f2.rowNumb-1
LEFT JOIN (
select id master_id,patient_id,inp_no,visit_id,name,dept_name,convert(varchar,discharge_date_time,120) discharge_date_time,check_doctor,first_instance,DOCTOR_IN_CHARGE,death_flag,dept_admission_to,convert(varchar,admission_date_time,120) admission_date_time from archive_master where archiveState!='作废'
select id master_id,patient_id,inp_no,visit_id,name,dept_name,convert(varchar,discharge_date_time,120) discharge_date_time,check_doctor,first_instance,DOCTOR_IN_CHARGE,death_flag,dept_admission_to,convert(varchar,admission_date_time,120) admission_date_time
from archive_master where 1=1 and ArchiveState!='作废' and ArchiveState!='已封存' and Is_Valid!=1
) m
on f1.master_id=m.master_id
LEFT JOIN (select code,name from emr_dictionary where parent_id=(select id from emr_dictionary where typeCode='dept_code' )) c
@ -1527,7 +1529,7 @@
LEFT JOIN (select code,name from emr_dictionary where parent_id=(select id from emr_dictionary where typeCode='dept_code' )) e
on m.dept_admission_to=e.code
<where> 1=1
<where> 1=1 and m.master_id!='' and m.master_id is not null
<iftest="overdueDaysTwo != null and overdueDaysTwo != '' and overdueDays != null and overdueDays != ''">
and ISNULL(dbo.f_WorkDay(DATEADD(DAY,1,CONVERT(VARCHAR(10),f1.handle_time,23)),CONVERT(VARCHAR(10),f2.handle_time,23)) , 0)-#{overdueDays,jdbcType=NCHAR}>=#{overdueDaysTwo,jdbcType=NCHAR}