diff --git a/src/main/resources/mapper/Archive_DetailMapper.xml b/src/main/resources/mapper/Archive_DetailMapper.xml
index 9bb313aa..da8a91b7 100644
--- a/src/main/resources/mapper/Archive_DetailMapper.xml
+++ b/src/main/resources/mapper/Archive_DetailMapper.xml
@@ -57,7 +57,7 @@
and id=#{patientId,jdbcType=VARCHAR}
)+'%'
- and visit_id=(select visit_id from Archive_Master where 1=1
+ and admission_date_time=(select admission_date_time from Archive_Master where 1=1
and id=#{patientId,jdbcType=VARCHAR}
)
@@ -86,7 +86,7 @@
and id=#{patientId,jdbcType=VARCHAR}
)+'%'
- and visit_id=(select visit_id from Archive_Master where 1=1
+ and admission_date_time=(select admission_date_time from Archive_Master where 1=1
and id=#{patientId,jdbcType=VARCHAR}
)
@@ -202,7 +202,7 @@
and id=#{patientId,jdbcType=VARCHAR}
- and visit_id=(select visit_id from Archive_Master where 1=1
+ and admission_date_time=(select admission_date_time from Archive_Master where 1=1
and id=#{patientId,jdbcType=VARCHAR}
)
@@ -223,6 +223,10 @@
and id=#{patientId,jdbcType=VARCHAR}
)+'%'
+ and admission_date_time=(select admission_date_time from Archive_Master where 1=1
+
+ and id=#{patientId,jdbcType=VARCHAR}
+ )
and patindex('%B%',inp_no) != 0
union
select id from archive_master where id=#{patientId,jdbcType=VARCHAR}