Преглед на файлове

完善病案首页功能。

lighter преди 4 години
родител
ревизия
bf65b3257a

+ 6 - 1
src/main/java/thyyxxk/webserver/controller/casefrontsheet/CaseFrontSheetController.java

@@ -36,6 +36,11 @@ public class CaseFrontSheetController {
         return service.getUserWards();
     }
 
+    @GetMapping("/getAllWards")
+    public ResultVo<List<PureCodeName>> getWards() {
+        return service.getAllWards();
+    }
+
     @GetMapping("/getPatientOverview")
     public ResultVo<List<SheetOverview>> getPatientOverview(String ward) {
         return service.getPatientOverview(ward);
@@ -112,7 +117,7 @@ public class CaseFrontSheetController {
     }
 
     @PostMapping("/advanceSearch")
-    public ResultVo<List<AdvanceOverview>> advanceSearch(@RequestBody AdvanceSearchParam param) {
+    public ResultVo<List<SheetOverview>> advanceSearch(@RequestBody AdvanceSearchParam param) {
         return service.advanceSearch(param);
     }
 

+ 657 - 0
src/main/java/thyyxxk/webserver/dao_his/casefrontsheet/BasSelectOverviewDao.java

@@ -0,0 +1,657 @@
+package thyyxxk.webserver.dao_his.casefrontsheet;
+
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
+import thyyxxk.webserver.pojo.casefrontsheet.GetOutSheetParam;
+import thyyxxk.webserver.pojo.casefrontsheet.SheetOverview;
+
+import java.util.List;
+
+@Mapper
+public interface BasSelectOverviewDao {
+    @Select("select " +
+            "signDate=(convert(varchar(10), b.sign_date, 21)), " +
+            "bedNo=rtrim(a.bed_no), " +
+            "bah=rtrim(a.inpatient_no), " +
+            "times=rtrim(a.admiss_times), " +
+            "name=rtrim(a.name), " +
+            "a.sex, " +
+            "deptName=(select rtrim(name) from zd_unit_code where code=a.dis_dept), " +
+            "doctorName=(select rtrim(name) from a_employee_mi where code=b.zyys), " +
+            "b.late_flag, " +
+            "lateCount=(select count(*) from batj_ba2 where late_flag=1 and zyys=b.zyys), " +
+            "lateDays=datediff(day, a.dis_date, b.sign_date), " +
+            "disDate=convert(varchar(10), a.dis_date, 21) " +
+            "from zy_inactpatient a, batj_ba2 b, yz_inact_order c " +
+            "where " +
+            "a.inpatient_no=#{bah} and " +
+            "a.inpatient_no=b.zyh and " +
+            "a.admiss_times=b.zycs and " +
+            "a.inpatient_no=c.inpatient_no and " +
+            "a.admiss_times=c.admiss_times and " +
+            "c.start_time>=#{start} and " +
+            "c.start_time<=#{end} and " +
+            "c.order_code in ('06026','06053','06027', '05973') and " +
+            "isnull(a.file_status, 0)=#{fileStatus} " +
+            "union " +
+            "select " +
+            "signDate=(convert(varchar(10), b.sign_date, 21)), " +
+            "bedNo=rtrim(a.bed_no), " +
+            "bah=rtrim(a.inpatient_no), " +
+            "times=rtrim(a.admiss_times), " +
+            "name=rtrim(a.name), " +
+            "a.sex, " +
+            "deptName=(select rtrim(name) from zd_unit_code where code=a.dis_dept), " +
+            "doctorName=(select rtrim(name) from a_employee_mi where code=b.zyys), " +
+            "b.late_flag, " +
+            "lateCount=(select count(*) from batj_ba2 where late_flag=1 and zyys=b.zyys), " +
+            "lateDays=datediff(day, a.dis_date, b.sign_date), " +
+            "disDate=convert(varchar(10), c.start_time, 21) " +
+            "from zy_actpatient a, batj_ba2 b, yz_act_order c " +
+            "where " +
+            "a.inpatient_no=#{bah} and " +
+            "a.inpatient_no=b.zyh and " +
+            "a.admiss_times=b.zycs and " +
+            "a.inpatient_no=c.inpatient_no and " +
+            "a.admiss_times=c.admiss_times and " +
+            "c.start_time>=#{start} and " +
+            "c.start_time<=#{end} and " +
+            "c.order_code in ('06026','06053','06027', '05973') and " +
+            "isnull(a.file_status, 0)=#{fileStatus} " +
+            "union " +
+            "select " +
+            "signDate=(convert(varchar(10), b.sign_date, 21)), " +
+            "bedNo=rtrim(a.bed_no), " +
+            "bah=rtrim(a.inpatient_no), " +
+            "times=rtrim(a.admiss_times), " +
+            "name=rtrim(a.name), " +
+            "a.sex, " +
+            "deptName=(select rtrim(name) from zd_unit_code where code=a.dis_dept), " +
+            "doctorName=(select rtrim(name) from a_employee_mi where code=b.zyys), " +
+            "b.late_flag, " +
+            "lateCount=(select count(*) from batj_ba2 where late_flag=1 and zyys=b.zyys), " +
+            "lateDays=datediff(day, a.dis_date, b.sign_date), " +
+            "disDate=convert(varchar(10), c.start_time, 21) " +
+            "from zy_actpatient a, batj_ba2 b, yz_inact_order c " +
+            "where " +
+            "a.inpatient_no=#{bah} and " +
+            "a.inpatient_no=b.zyh and " +
+            "a.admiss_times=b.zycs and " +
+            "a.inpatient_no=c.inpatient_no and " +
+            "a.admiss_times=c.admiss_times and " +
+            "c.start_time>=#{start} and " +
+            "c.start_time<=#{end} and " +
+            "c.order_code in ('06026','06053','06027', '05973') and " +
+            "isnull(a.file_status, 0)=#{fileStatus} " +
+            "union " +
+            "select " +
+            "signDate=(convert(varchar(10), b.sign_date, 21)), " +
+            "bedNo=rtrim(a.bed_no), " +
+            "bah=rtrim(a.inpatient_no), " +
+            "times=rtrim(a.admiss_times), " +
+            "name=rtrim(a.name), " +
+            "a.sex, " +
+            "deptName=(select rtrim(name) from zd_unit_code where code=a.dis_dept), " +
+            "doctorName=(select rtrim(name) from a_employee_mi where code=b.zyys), " +
+            "b.late_flag, " +
+            "lateCount=(select count(*) from batj_ba2 where late_flag=1 and zyys=b.zyys), " +
+            "lateDays=datediff(day, a.dis_date, b.sign_date), " +
+            "disDate=convert(varchar(10), c.start_time, 21) " +
+            "from zy_inactpatient a, batj_ba2 b, yz_act_order c " +
+            "where " +
+            "a.inpatient_no=#{bah} and " +
+            "a.inpatient_no=b.zyh and " +
+            "a.admiss_times=b.zycs and " +
+            "a.inpatient_no=c.inpatient_no and " +
+            "a.admiss_times=c.admiss_times and " +
+            "c.start_time>=#{start} and " +
+            "c.start_time<=#{end} and " +
+            "c.order_code in ('06026','06053','06027', '05973') and " +
+            "isnull(a.file_status, 0)=#{fileStatus} ")
+    List<SheetOverview> selectPatientsForBasByBah(GetOutSheetParam param);
+
+    @Select("select " +
+            "signDate=(convert(varchar(10), b.sign_date, 21)), " +
+            "bedNo=rtrim(a.bed_no), " +
+            "bah=rtrim(a.inpatient_no), " +
+            "times=rtrim(a.admiss_times), " +
+            "name=rtrim(a.name), " +
+            "a.sex, " +
+            "deptName=(select rtrim(name) from zd_unit_code where code=a.dis_dept), " +
+            "doctorName=(select rtrim(name) from a_employee_mi where code=b.zyys), " +
+            "b.late_flag, " +
+            "lateCount=(select count(*) from batj_ba2 where late_flag=1 and zyys=b.zyys), " +
+            "lateDays=datediff(day, a.dis_date, b.sign_date), " +
+            "disDate=convert(varchar(10), a.dis_date, 21) " +
+            "from zy_inactpatient a, batj_ba2 b, yz_inact_order c " +
+            "where " +
+            "a.inpatient_no=#{bah} and " +
+            "a.inpatient_no=b.zyh and " +
+            "a.admiss_times=b.zycs and " +
+            "a.inpatient_no=c.inpatient_no and " +
+            "a.admiss_times=c.admiss_times and " +
+            "c.start_time>=#{start} and " +
+            "c.start_time<=#{end} and " +
+            "c.order_code in ('06026','06053','06027', '05973') and " +
+            "isnull(a.file_status, 0)>=1 " +
+            "union " +
+            "select " +
+            "signDate=(convert(varchar(10), b.sign_date, 21)), " +
+            "bedNo=rtrim(a.bed_no), " +
+            "bah=rtrim(a.inpatient_no), " +
+            "times=rtrim(a.admiss_times), " +
+            "name=rtrim(a.name), " +
+            "a.sex, " +
+            "deptName=(select rtrim(name) from zd_unit_code where code=a.dis_dept), " +
+            "doctorName=(select rtrim(name) from a_employee_mi where code=b.zyys), " +
+            "b.late_flag, " +
+            "lateCount=(select count(*) from batj_ba2 where late_flag=1 and zyys=b.zyys), " +
+            "lateDays=datediff(day, a.dis_date, b.sign_date), " +
+            "disDate=convert(varchar(10), c.start_time, 21) " +
+            "from zy_actpatient a, batj_ba2 b, yz_act_order c " +
+            "where " +
+            "a.inpatient_no=#{bah} and " +
+            "a.inpatient_no=b.zyh and " +
+            "a.admiss_times=b.zycs and " +
+            "a.inpatient_no=c.inpatient_no and " +
+            "a.admiss_times=c.admiss_times and " +
+            "c.start_time>=#{start} and " +
+            "c.start_time<=#{end} and " +
+            "c.order_code in ('06026','06053','06027', '05973') and " +
+            "isnull(a.file_status, 0)>=1 " +
+            "union " +
+            "select " +
+            "signDate=(convert(varchar(10), b.sign_date, 21)), " +
+            "bedNo=rtrim(a.bed_no), " +
+            "bah=rtrim(a.inpatient_no), " +
+            "times=rtrim(a.admiss_times), " +
+            "name=rtrim(a.name), " +
+            "a.sex, " +
+            "deptName=(select rtrim(name) from zd_unit_code where code=a.dis_dept), " +
+            "doctorName=(select rtrim(name) from a_employee_mi where code=b.zyys), " +
+            "b.late_flag, " +
+            "lateCount=(select count(*) from batj_ba2 where late_flag=1 and zyys=b.zyys), " +
+            "lateDays=datediff(day, a.dis_date, b.sign_date), " +
+            "disDate=convert(varchar(10), c.start_time, 21) " +
+            "from zy_actpatient a, batj_ba2 b, yz_inact_order c " +
+            "where " +
+            "a.inpatient_no=#{bah} and " +
+            "a.inpatient_no=b.zyh and " +
+            "a.admiss_times=b.zycs and " +
+            "a.inpatient_no=c.inpatient_no and " +
+            "a.admiss_times=c.admiss_times and " +
+            "c.start_time>=#{start} and " +
+            "c.start_time<=#{end} and " +
+            "c.order_code in ('06026','06053','06027', '05973') and " +
+            "isnull(a.file_status, 0)>=1 " +
+            "union " +
+            "select " +
+            "signDate=(convert(varchar(10), b.sign_date, 21)), " +
+            "bedNo=rtrim(a.bed_no), " +
+            "bah=rtrim(a.inpatient_no), " +
+            "times=rtrim(a.admiss_times), " +
+            "name=rtrim(a.name), " +
+            "a.sex, " +
+            "deptName=(select rtrim(name) from zd_unit_code where code=a.dis_dept), " +
+            "doctorName=(select rtrim(name) from a_employee_mi where code=b.zyys), " +
+            "b.late_flag, " +
+            "lateCount=(select count(*) from batj_ba2 where late_flag=1 and zyys=b.zyys), " +
+            "lateDays=datediff(day, a.dis_date, b.sign_date), " +
+            "disDate=convert(varchar(10), c.start_time, 21) " +
+            "from zy_inactpatient a, batj_ba2 b, yz_act_order c " +
+            "where " +
+            "a.inpatient_no=#{bah} and " +
+            "a.inpatient_no=b.zyh and " +
+            "a.admiss_times=b.zycs and " +
+            "a.inpatient_no=c.inpatient_no and " +
+            "a.admiss_times=c.admiss_times and " +
+            "c.start_time>=#{start} and " +
+            "c.start_time<=#{end} and " +
+            "c.order_code in ('06026','06053','06027', '05973') and " +
+            "isnull(a.file_status, 0)>=1 ")
+    List<SheetOverview> selectPatientsForBasByBah2(GetOutSheetParam param);
+
+    @Select("select " +
+            "signDate=(convert(varchar(10), b.sign_date, 21)), " +
+            "bedNo=rtrim(a.bed_no), " +
+            "bah=rtrim(a.inpatient_no), " +
+            "times=rtrim(a.admiss_times), " +
+            "name=rtrim(a.name), " +
+            "a.sex, " +
+            "deptName=(select rtrim(name) from zd_unit_code where code=a.dis_dept), " +
+            "doctorName=(select rtrim(name) from a_employee_mi where code=b.zyys), " +
+            "b.late_flag, " +
+            "lateCount=(select count(*) from batj_ba2 where late_flag=1 and zyys=b.zyys), " +
+            "lateDays=datediff(day, a.dis_date, b.sign_date), " +
+            "disDate=convert(varchar(10), a.dis_date, 21) " +
+            "from zy_inactpatient a, batj_ba2 b, yz_inact_order c " +
+            "where " +
+            "a.inpatient_no not like 'S%' and " +
+            "a.inpatient_no not like 'JT%' and " +
+            "a.inpatient_no=b.zyh and " +
+            "a.admiss_times=b.zycs and " +
+            "a.inpatient_no=c.inpatient_no and " +
+            "a.admiss_times=c.admiss_times and " +
+            "c.start_time>=#{start} and " +
+            "c.start_time<=#{end} and " +
+            "c.order_code in ('06026','06053','06027', '05973') and " +
+            "c.exec_unit = #{ward} and " +
+            "isnull(a.file_status, 0)=#{fileStatus} and " +
+            "charindex('$',a.inpatient_no)=0 " +
+            "union " +
+            "select " +
+            "signDate=(convert(varchar(10), b.sign_date, 21)), " +
+            "bedNo=rtrim(a.bed_no), " +
+            "bah=rtrim(a.inpatient_no), " +
+            "times=rtrim(a.admiss_times), " +
+            "name=rtrim(a.name), " +
+            "a.sex, " +
+            "deptName=(select rtrim(name) from zd_unit_code where code=a.dis_dept), " +
+            "doctorName=(select rtrim(name) from a_employee_mi where code=b.zyys), " +
+            "b.late_flag, " +
+            "lateCount=(select count(*) from batj_ba2 where late_flag=1 and zyys=b.zyys), " +
+            "lateDays=datediff(day, a.dis_date, b.sign_date), " +
+            "disDate=convert(varchar(10), c.start_time, 21) " +
+            "from zy_actpatient a, batj_ba2 b, yz_act_order c " +
+            "where " +
+            "a.inpatient_no not like 'S%' and " +
+            "a.inpatient_no not like 'JT%' and " +
+            "a.inpatient_no=b.zyh and " +
+            "a.admiss_times=b.zycs and " +
+            "a.inpatient_no=c.inpatient_no and " +
+            "a.admiss_times=c.admiss_times and " +
+            "c.start_time>=#{start} and " +
+            "c.start_time<=#{end} and " +
+            "c.order_code in ('06026','06053','06027', '05973') and " +
+            "c.exec_unit = #{ward} and " +
+            "isnull(a.file_status, 0)=#{fileStatus} and " +
+            "charindex('$',a.inpatient_no)=0 " +
+            "union " +
+            "select " +
+            "signDate=(convert(varchar(10), b.sign_date, 21)), " +
+            "bedNo=rtrim(a.bed_no), " +
+            "bah=rtrim(a.inpatient_no), " +
+            "times=rtrim(a.admiss_times), " +
+            "name=rtrim(a.name), " +
+            "a.sex, " +
+            "deptName=(select rtrim(name) from zd_unit_code where code=a.dis_dept), " +
+            "doctorName=(select rtrim(name) from a_employee_mi where code=b.zyys), " +
+            "b.late_flag, " +
+            "lateCount=(select count(*) from batj_ba2 where late_flag=1 and zyys=b.zyys), " +
+            "lateDays=datediff(day, a.dis_date, b.sign_date), " +
+            "disDate=convert(varchar(10), c.start_time, 21) " +
+            "from zy_actpatient a, batj_ba2 b, yz_inact_order c " +
+            "where " +
+            "a.inpatient_no not like 'S%' and " +
+            "a.inpatient_no not like 'JT%' and " +
+            "a.inpatient_no=b.zyh and " +
+            "a.admiss_times=b.zycs and " +
+            "a.inpatient_no=c.inpatient_no and " +
+            "a.admiss_times=c.admiss_times and " +
+            "c.start_time>=#{start} and " +
+            "c.start_time<=#{end} and " +
+            "c.order_code in ('06026','06053','06027', '05973') and " +
+            "c.exec_unit = #{ward} and " +
+            "isnull(a.file_status, 0)=#{fileStatus} and " +
+            "charindex('$',a.inpatient_no)=0 " +
+            "union " +
+            "select " +
+            "signDate=(convert(varchar(10), b.sign_date, 21)), " +
+            "bedNo=rtrim(a.bed_no), " +
+            "bah=rtrim(a.inpatient_no), " +
+            "times=rtrim(a.admiss_times), " +
+            "name=rtrim(a.name), " +
+            "a.sex, " +
+            "deptName=(select rtrim(name) from zd_unit_code where code=a.dis_dept), " +
+            "doctorName=(select rtrim(name) from a_employee_mi where code=b.zyys), " +
+            "b.late_flag, " +
+            "lateCount=(select count(*) from batj_ba2 where late_flag=1 and zyys=b.zyys), " +
+            "lateDays=datediff(day, a.dis_date, b.sign_date), " +
+            "disDate=convert(varchar(10), c.start_time, 21) " +
+            "from zy_inactpatient a, batj_ba2 b, yz_act_order c " +
+            "where " +
+            "a.inpatient_no not like 'S%' and " +
+            "a.inpatient_no not like 'JT%' and " +
+            "a.inpatient_no=b.zyh and " +
+            "a.admiss_times=b.zycs and " +
+            "a.inpatient_no=c.inpatient_no and " +
+            "a.admiss_times=c.admiss_times and " +
+            "c.start_time>=#{start} and " +
+            "c.start_time<=#{end} and " +
+            "c.order_code in ('06026','06053','06027', '05973') and " +
+            "c.exec_unit = #{ward} and " +
+            "isnull(a.file_status, 0)=#{fileStatus} and " +
+            "charindex('$',a.inpatient_no)=0 ")
+    List<SheetOverview> selectPatientsForBasByWard(GetOutSheetParam param);
+
+    @Select("select " +
+            "signDate=(convert(varchar(10), b.sign_date, 21)), " +
+            "bedNo=rtrim(a.bed_no), " +
+            "bah=rtrim(a.inpatient_no), " +
+            "times=rtrim(a.admiss_times), " +
+            "name=rtrim(a.name), " +
+            "a.sex, " +
+            "deptName=(select rtrim(name) from zd_unit_code where code=a.dis_dept), " +
+            "doctorName=(select rtrim(name) from a_employee_mi where code=b.zyys), " +
+            "b.late_flag, " +
+            "lateCount=(select count(*) from batj_ba2 where late_flag=1 and zyys=b.zyys), " +
+            "lateDays=datediff(day, a.dis_date, b.sign_date), " +
+            "disDate=convert(varchar(10), a.dis_date, 21) " +
+            "from zy_inactpatient a, batj_ba2 b, yz_inact_order c " +
+            "where " +
+            "a.inpatient_no not like 'S%' and " +
+            "a.inpatient_no not like 'JT%' and " +
+            "a.inpatient_no=b.zyh and " +
+            "a.admiss_times=b.zycs and " +
+            "a.inpatient_no=c.inpatient_no and " +
+            "a.admiss_times=c.admiss_times and " +
+            "c.start_time>=#{start} and " +
+            "c.start_time<=#{end} and " +
+            "c.order_code in ('06026','06053','06027', '05973') and " +
+            "c.exec_unit = #{ward} and " +
+            "isnull(a.file_status, 0)>=1 and " +
+            "charindex('$',a.inpatient_no)=0 " +
+            "union " +
+            "select " +
+            "signDate=(convert(varchar(10), b.sign_date, 21)), " +
+            "bedNo=rtrim(a.bed_no), " +
+            "bah=rtrim(a.inpatient_no), " +
+            "times=rtrim(a.admiss_times), " +
+            "name=rtrim(a.name), " +
+            "a.sex, " +
+            "deptName=(select rtrim(name) from zd_unit_code where code=a.dis_dept), " +
+            "doctorName=(select rtrim(name) from a_employee_mi where code=b.zyys), " +
+            "b.late_flag, " +
+            "lateCount=(select count(*) from batj_ba2 where late_flag=1 and zyys=b.zyys), " +
+            "lateDays=datediff(day, a.dis_date, b.sign_date), " +
+            "disDate=convert(varchar(10), c.start_time, 21) " +
+            "from zy_actpatient a, batj_ba2 b, yz_act_order c " +
+            "where " +
+            "a.inpatient_no not like 'S%' and " +
+            "a.inpatient_no not like 'JT%' and " +
+            "a.inpatient_no=b.zyh and " +
+            "a.admiss_times=b.zycs and " +
+            "a.inpatient_no=c.inpatient_no and " +
+            "a.admiss_times=c.admiss_times and " +
+            "c.start_time>=#{start} and " +
+            "c.start_time<=#{end} and " +
+            "c.order_code in ('06026','06053','06027', '05973') and " +
+            "c.exec_unit = #{ward} and " +
+            "isnull(a.file_status, 0)>=1 and " +
+            "charindex('$',a.inpatient_no)=0 " +
+            "union " +
+            "select " +
+            "signDate=(convert(varchar(10), b.sign_date, 21)), " +
+            "bedNo=rtrim(a.bed_no), " +
+            "bah=rtrim(a.inpatient_no), " +
+            "times=rtrim(a.admiss_times), " +
+            "name=rtrim(a.name), " +
+            "a.sex, " +
+            "deptName=(select rtrim(name) from zd_unit_code where code=a.dis_dept), " +
+            "doctorName=(select rtrim(name) from a_employee_mi where code=b.zyys), " +
+            "b.late_flag, " +
+            "lateCount=(select count(*) from batj_ba2 where late_flag=1 and zyys=b.zyys), " +
+            "lateDays=datediff(day, a.dis_date, b.sign_date), " +
+            "disDate=convert(varchar(10), c.start_time, 21) " +
+            "from zy_actpatient a, batj_ba2 b, yz_inact_order c " +
+            "where " +
+            "a.inpatient_no not like 'S%' and " +
+            "a.inpatient_no not like 'JT%' and " +
+            "a.inpatient_no=b.zyh and " +
+            "a.admiss_times=b.zycs and " +
+            "a.inpatient_no=c.inpatient_no and " +
+            "a.admiss_times=c.admiss_times and " +
+            "c.start_time>=#{start} and " +
+            "c.start_time<=#{end} and " +
+            "c.order_code in ('06026','06053','06027', '05973') and " +
+            "c.exec_unit = #{ward} and " +
+            "isnull(a.file_status, 0)>=1 and " +
+            "charindex('$',a.inpatient_no)=0 " +
+            "union " +
+            "select " +
+            "signDate=(convert(varchar(10), b.sign_date, 21)), " +
+            "bedNo=rtrim(a.bed_no), " +
+            "bah=rtrim(a.inpatient_no), " +
+            "times=rtrim(a.admiss_times), " +
+            "name=rtrim(a.name), " +
+            "a.sex, " +
+            "deptName=(select rtrim(name) from zd_unit_code where code=a.dis_dept), " +
+            "doctorName=(select rtrim(name) from a_employee_mi where code=b.zyys), " +
+            "b.late_flag, " +
+            "lateCount=(select count(*) from batj_ba2 where late_flag=1 and zyys=b.zyys), " +
+            "lateDays=datediff(day, a.dis_date, b.sign_date), " +
+            "disDate=convert(varchar(10), c.start_time, 21) " +
+            "from zy_inactpatient a, batj_ba2 b, yz_act_order c " +
+            "where " +
+            "a.inpatient_no not like 'S%' and " +
+            "a.inpatient_no not like 'JT%' and " +
+            "a.inpatient_no=b.zyh and " +
+            "a.admiss_times=b.zycs and " +
+            "a.inpatient_no=c.inpatient_no and " +
+            "a.admiss_times=c.admiss_times and " +
+            "c.start_time>=#{start} and " +
+            "c.start_time<=#{end} and " +
+            "c.order_code in ('06026','06053','06027', '05973') and " +
+            "c.exec_unit = #{ward} and " +
+            "isnull(a.file_status, 0)>=1 and " +
+            "charindex('$',a.inpatient_no)=0 ")
+    List<SheetOverview> selectPatientsForBasByWard2(GetOutSheetParam param);
+
+    @Select("select " +
+            " signDate=(convert(varchar(10), b.sign_date, 21)), " +
+            "bedNo=rtrim(a.bed_no), " +
+            "bah=rtrim(a.inpatient_no), " +
+            "times=rtrim(a.admiss_times), " +
+            "name=rtrim(a.name), " +
+            "a.sex, " +
+            "deptName=(select rtrim(name) from zd_unit_code where code=a.dis_dept), " +
+            "doctorName=(select rtrim(name) from a_employee_mi where code=b.zyys), " +
+            "b.late_flag, " +
+            "lateCount=(select count(*) from batj_ba2 where late_flag=1 and zyys=b.zyys), " +
+            "lateDays=datediff(day, a.dis_date, b.sign_date), " +
+            "disDate=convert(varchar(10), a.dis_date, 21) " +
+            "from zy_inactpatient a, batj_ba2 b, yz_inact_order c " +
+            "where " +
+            "a.inpatient_no not like 'S%' and " +
+            "a.inpatient_no not like 'JT%' and " +
+            "a.inpatient_no=b.zyh and " +
+            "a.admiss_times=b.zycs and " +
+            "a.inpatient_no=c.inpatient_no and " +
+            "a.admiss_times=c.admiss_times and " +
+            "c.start_time>=#{start} and " +
+            "c.start_time<=#{end} and " +
+            "c.order_code in ('06026','06053','06027', '05973') and " +
+            "isnull(a.file_status, 0)=#{fileStatus} and " +
+            "charindex('$',a.inpatient_no)=0 " +
+            "union " +
+            "select " +
+            "signDate=(convert(varchar(10), b.sign_date, 21)), " +
+            "bedNo=rtrim(a.bed_no), " +
+            "bah=rtrim(a.inpatient_no), " +
+            "times=rtrim(a.admiss_times), " +
+            "name=rtrim(a.name), " +
+            "a.sex, " +
+            "deptName=(select rtrim(name) from zd_unit_code where code=a.dis_dept), " +
+            "doctorName=(select rtrim(name) from a_employee_mi where code=b.zyys), " +
+            "b.late_flag, " +
+            "lateCount=(select count(*) from batj_ba2 where late_flag=1 and zyys=b.zyys), " +
+            "lateDays=datediff(day, a.dis_date, b.sign_date), " +
+            "disDate=convert(varchar(10), c.start_time, 21) " +
+            "from zy_actpatient a, batj_ba2 b, yz_act_order c " +
+            "where " +
+            "a.inpatient_no not like 'S%' and " +
+            "a.inpatient_no not like 'JT%' and " +
+            "a.inpatient_no=b.zyh and " +
+            "a.admiss_times=b.zycs and " +
+            "a.inpatient_no=c.inpatient_no and " +
+            "a.admiss_times=c.admiss_times and " +
+            "c.start_time>=#{start} and " +
+            "c.start_time<=#{end} and " +
+            "c.order_code in ('06026','06053','06027', '05973') and " +
+            "isnull(a.file_status, 0)=#{fileStatus} and " +
+            "charindex('$',a.inpatient_no)=0 " +
+            "union " +
+            "select " +
+            "signDate=(convert(varchar(10), b.sign_date, 21)), " +
+            "bedNo=rtrim(a.bed_no), " +
+            "bah=rtrim(a.inpatient_no), " +
+            "times=rtrim(a.admiss_times), " +
+            "name=rtrim(a.name), " +
+            "a.sex, " +
+            "deptName=(select rtrim(name) from zd_unit_code where code=a.dis_dept), " +
+            "doctorName=(select rtrim(name) from a_employee_mi where code=b.zyys), " +
+            "b.late_flag, " +
+            "lateCount=(select count(*) from batj_ba2 where late_flag=1 and zyys=b.zyys), " +
+            "lateDays=datediff(day, a.dis_date, b.sign_date), " +
+            "disDate=convert(varchar(10), c.start_time, 21) " +
+            "from zy_actpatient a, batj_ba2 b, yz_inact_order c " +
+            "where " +
+            "a.inpatient_no not like 'S%' and " +
+            "a.inpatient_no not like 'JT%' and " +
+            "a.inpatient_no=b.zyh and " +
+            "a.admiss_times=b.zycs and " +
+            "a.inpatient_no=c.inpatient_no and " +
+            "a.admiss_times=c.admiss_times and " +
+            "c.start_time>=#{start} and " +
+            "c.start_time<=#{end} and " +
+            "c.order_code in ('06026','06053','06027', '05973') and " +
+            "isnull(a.file_status, 0)=#{fileStatus} and " +
+            "charindex('$',a.inpatient_no)=0 " +
+            "union " +
+            "select " +
+            "signDate=(convert(varchar(10), b.sign_date, 21)), " +
+            "bedNo=rtrim(a.bed_no), " +
+            "bah=rtrim(a.inpatient_no), " +
+            "times=rtrim(a.admiss_times), " +
+            "name=rtrim(a.name), " +
+            "a.sex, " +
+            "deptName=(select rtrim(name) from zd_unit_code where code=a.dis_dept), " +
+            "doctorName=(select rtrim(name) from a_employee_mi where code=b.zyys), " +
+            "b.late_flag, " +
+            "lateCount=(select count(*) from batj_ba2 where late_flag=1 and zyys=b.zyys), " +
+            "lateDays=datediff(day, a.dis_date, b.sign_date), " +
+            "disDate=convert(varchar(10), c.start_time, 21) " +
+            "from zy_inactpatient a, batj_ba2 b, yz_act_order c " +
+            "where " +
+            "a.inpatient_no not like 'S%' and " +
+            "a.inpatient_no not like 'JT%' and " +
+            "a.inpatient_no=b.zyh and " +
+            "a.admiss_times=b.zycs and " +
+            "a.inpatient_no=c.inpatient_no and " +
+            "a.admiss_times=c.admiss_times and " +
+            "c.start_time>=#{start} and " +
+            "c.start_time<=#{end} and " +
+            "c.order_code in ('06026','06053','06027', '05973') and " +
+            "isnull(a.file_status, 0)=#{fileStatus} and " +
+            "charindex('$',a.inpatient_no)=0 ")
+    List<SheetOverview> selectPatientsForBasByFileStatus(GetOutSheetParam param);
+
+    @Select("select " +
+            " signDate=(convert(varchar(10), b.sign_date, 21)), " +
+            "bedNo=rtrim(a.bed_no), " +
+            "bah=rtrim(a.inpatient_no), " +
+            "times=rtrim(a.admiss_times), " +
+            "name=rtrim(a.name), " +
+            "a.sex, " +
+            "deptName=(select rtrim(name) from zd_unit_code where code=a.dis_dept), " +
+            "doctorName=(select rtrim(name) from a_employee_mi where code=b.zyys), " +
+            "b.late_flag, " +
+            "lateCount=(select count(*) from batj_ba2 where late_flag=1 and zyys=b.zyys), " +
+            "lateDays=datediff(day, a.dis_date, b.sign_date), " +
+            "disDate=convert(varchar(10), a.dis_date, 21) " +
+            "from zy_inactpatient a, batj_ba2 b, yz_inact_order c " +
+            "where " +
+            "a.inpatient_no not like 'S%' and " +
+            "a.inpatient_no not like 'JT%' and " +
+            "a.inpatient_no=b.zyh and " +
+            "a.admiss_times=b.zycs and " +
+            "a.inpatient_no=c.inpatient_no and " +
+            "a.admiss_times=c.admiss_times and " +
+            "c.start_time>=#{start} and " +
+            "c.start_time<=#{end} and " +
+            "c.order_code in ('06026','06053','06027', '05973') and " +
+            "isnull(a.file_status, 0)>=1 and " +
+            "charindex('$',a.inpatient_no)=0 " +
+            "union " +
+            "select " +
+            "signDate=(convert(varchar(10), b.sign_date, 21)), " +
+            "bedNo=rtrim(a.bed_no), " +
+            "bah=rtrim(a.inpatient_no), " +
+            "times=rtrim(a.admiss_times), " +
+            "name=rtrim(a.name), " +
+            "a.sex, " +
+            "deptName=(select rtrim(name) from zd_unit_code where code=a.dis_dept), " +
+            "doctorName=(select rtrim(name) from a_employee_mi where code=b.zyys), " +
+            "b.late_flag, " +
+            "lateCount=(select count(*) from batj_ba2 where late_flag=1 and zyys=b.zyys), " +
+            "lateDays=datediff(day, a.dis_date, b.sign_date), " +
+            "disDate=convert(varchar(10), c.start_time, 21) " +
+            "from zy_actpatient a, batj_ba2 b, yz_act_order c " +
+            "where " +
+            "a.inpatient_no not like 'S%' and " +
+            "a.inpatient_no not like 'JT%' and " +
+            "a.inpatient_no=b.zyh and " +
+            "a.admiss_times=b.zycs and " +
+            "a.inpatient_no=c.inpatient_no and " +
+            "a.admiss_times=c.admiss_times and " +
+            "c.start_time>=#{start} and " +
+            "c.start_time<=#{end} and " +
+            "c.order_code in ('06026','06053','06027', '05973') and " +
+            "isnull(a.file_status, 0)>=1 and " +
+            "charindex('$',a.inpatient_no)=0 " +
+            "union " +
+            "select " +
+            "signDate=(convert(varchar(10), b.sign_date, 21)), " +
+            "bedNo=rtrim(a.bed_no), " +
+            "bah=rtrim(a.inpatient_no), " +
+            "times=rtrim(a.admiss_times), " +
+            "name=rtrim(a.name), " +
+            "a.sex, " +
+            "deptName=(select rtrim(name) from zd_unit_code where code=a.dis_dept), " +
+            "doctorName=(select rtrim(name) from a_employee_mi where code=b.zyys), " +
+            "b.late_flag, " +
+            "lateCount=(select count(*) from batj_ba2 where late_flag=1 and zyys=b.zyys), " +
+            "lateDays=datediff(day, a.dis_date, b.sign_date), " +
+            "disDate=convert(varchar(10), c.start_time, 21) " +
+            "from zy_actpatient a, batj_ba2 b, yz_inact_order c " +
+            "where " +
+            "a.inpatient_no not like 'S%' and " +
+            "a.inpatient_no not like 'JT%' and " +
+            "a.inpatient_no=b.zyh and " +
+            "a.admiss_times=b.zycs and " +
+            "a.inpatient_no=c.inpatient_no and " +
+            "a.admiss_times=c.admiss_times and " +
+            "c.start_time>=#{start} and " +
+            "c.start_time<=#{end} and " +
+            "c.order_code in ('06026','06053','06027', '05973') and " +
+            "isnull(a.file_status, 0)>=1 and " +
+            "charindex('$',a.inpatient_no)=0 " +
+            "union " +
+            "select " +
+            "signDate=(convert(varchar(10), b.sign_date, 21)), " +
+            "bedNo=rtrim(a.bed_no), " +
+            "bah=rtrim(a.inpatient_no), " +
+            "times=rtrim(a.admiss_times), " +
+            "name=rtrim(a.name), " +
+            "a.sex, " +
+            "deptName=(select rtrim(name) from zd_unit_code where code=a.dis_dept), " +
+            "doctorName=(select rtrim(name) from a_employee_mi where code=b.zyys), " +
+            "b.late_flag, " +
+            "lateCount=(select count(*) from batj_ba2 where late_flag=1 and zyys=b.zyys), " +
+            "lateDays=datediff(day, a.dis_date, b.sign_date), " +
+            "disDate=convert(varchar(10), c.start_time, 21) " +
+            "from zy_inactpatient a, batj_ba2 b, yz_act_order c " +
+            "where " +
+            "a.inpatient_no not like 'S%' and " +
+            "a.inpatient_no not like 'JT%' and " +
+            "a.inpatient_no=b.zyh and " +
+            "a.admiss_times=b.zycs and " +
+            "a.inpatient_no=c.inpatient_no and " +
+            "a.admiss_times=c.admiss_times and " +
+            "c.start_time>=#{start} and " +
+            "c.start_time<=#{end} and " +
+            "c.order_code in ('06026','06053','06027', '05973') and " +
+            "isnull(a.file_status, 0)>=1 and " +
+            "charindex('$',a.inpatient_no)=0 ")
+    List<SheetOverview> selectPatientsForBasByFileStatus2(GetOutSheetParam param);
+}

+ 20 - 130
src/main/java/thyyxxk/webserver/dao_his/casefrontsheet/CaseFrontSheetDao.java

@@ -35,124 +35,6 @@ public interface CaseFrontSheetDao {
             "ORDER BY cast(bed_no AS int)")
     List<SheetOverview> getOutPatients(GetOutSheetParam param);
 
-    @Select("select " +
-            "signDate=(convert(varchar(10), b.sign_date, 21))," +
-            "bedNo=rtrim(a.bed_no), " +
-            "bah=rtrim(a.inpatient_no), " +
-            "times=rtrim(a.admiss_times), " +
-            "name=rtrim(a.name), " +
-            "a.sex, " +
-            "deptName=(select rtrim(name) from zd_unit_code where code=a.dis_dept), " +
-            "doctorName=(select rtrim(name) from a_employee_mi where code=b.zyys), " +
-            "lateCount=(select count(*) from batj_ba2 where late_flag=1 and zyys=b.zyys)," +
-            "lateDays=datediff(day, a.dis_date, b.sign_date)," +
-            "disDate=convert(varchar(10), a.dis_date, 21) " +
-            "from zy_inactpatient a, batj_ba2 b, yz_inact_order c " +
-            "where " +
-            "a.inpatient_no not like 'S%' and " +
-            "a.inpatient_no not like 'JT%' and " +
-            "a.inpatient_no=b.zyh and " +
-            "a.admiss_times=b.zycs and " +
-            "a.inpatient_no=c.inpatient_no and " +
-            "a.admiss_times=c.admiss_times and " +
-            "c.start_time>=#{start} and " +
-            "c.start_time<=#{end} and " +
-            "c.order_code in ('06026','06053','06027', '05973') and " +
-            "c.exec_unit like #{ward} and " +
-            "isnull(a.file_status, 0)=#{fileStatus} and " +
-            "a.inpatient_no like #{bah} and " +
-            "isnull(b.late_flag, '') like #{lateFlag} and " +
-            "charindex('$',a.inpatient_no)=0 " +
-            "union " +
-            "select " +
-            "signDate=(convert(varchar(10), b.sign_date, 21))," +
-            "bedNo=rtrim(a.bed_no), " +
-            "bah=rtrim(a.inpatient_no), " +
-            "times=rtrim(a.admiss_times), " +
-            "name=rtrim(a.name), " +
-            "a.sex, " +
-            "deptName=(select rtrim(name) from zd_unit_code where code=a.dis_dept), " +
-            "doctorName=(select rtrim(name) from a_employee_mi where code=b.zyys), " +
-            "lateCount=(select count(*) from batj_ba2 where late_flag=1 and zyys=b.zyys), " +
-            "lateDays=datediff(day, a.dis_date, b.sign_date), " +
-            "disDate=convert(varchar(10), c.start_time, 21) " +
-            "from zy_actpatient a, batj_ba2 b, yz_act_order c " +
-            "where " +
-            "a.inpatient_no not like 'S%' and " +
-            "a.inpatient_no not like 'JT%' and " +
-            "a.inpatient_no=b.zyh and " +
-            "a.admiss_times=b.zycs and " +
-            "a.inpatient_no=c.inpatient_no and " +
-            "a.admiss_times=c.admiss_times and " +
-            "c.start_time>=#{start} and " +
-            "c.start_time<=#{end} and " +
-            "c.order_code in ('06026','06053','06027', '05973') and " +
-            "c.exec_unit like #{ward} and " +
-            "isnull(a.file_status, 0)=#{fileStatus} and " +
-            "a.inpatient_no like #{bah} and " +
-            "isnull(b.late_flag, '') like #{lateFlag} and " +
-            "charindex('$',a.inpatient_no)=0 " +
-            "union " +
-            "select " +
-            "signDate=(convert(varchar(10), b.sign_date, 21))," +
-            "bedNo=rtrim(a.bed_no), " +
-            "bah=rtrim(a.inpatient_no), " +
-            "times=rtrim(a.admiss_times), " +
-            "name=rtrim(a.name), " +
-            "a.sex, " +
-            "deptName=(select rtrim(name) from zd_unit_code where code=a.dis_dept), " +
-            "doctorName=(select rtrim(name) from a_employee_mi where code=b.zyys), " +
-            "lateCount=(select count(*) from batj_ba2 where late_flag=1 and zyys=b.zyys), " +
-            "lateDays=datediff(day, a.dis_date, b.sign_date), " +
-            "disDate=convert(varchar(10), c.start_time, 21) " +
-            "from zy_actpatient a, batj_ba2 b, yz_inact_order c " +
-            "where " +
-            "a.inpatient_no not like 'S%' and " +
-            "a.inpatient_no not like 'JT%' and " +
-            "a.inpatient_no=b.zyh and " +
-            "a.admiss_times=b.zycs and " +
-            "a.inpatient_no=c.inpatient_no and " +
-            "a.admiss_times=c.admiss_times and " +
-            "c.start_time>=#{start} and " +
-            "c.start_time<=#{end} and " +
-            "c.order_code in ('06026','06053','06027', '05973') and " +
-            "c.exec_unit like #{ward} and " +
-            "isnull(a.file_status, 0)=#{fileStatus} and " +
-            "a.inpatient_no like #{bah} and " +
-            "isnull(b.late_flag, '') like #{lateFlag} and " +
-            "charindex('$',a.inpatient_no)=0 " +
-            "union " +
-            "select " +
-            "signDate=(convert(varchar(10), b.sign_date, 21))," +
-            "bedNo=rtrim(a.bed_no), " +
-            "bah=rtrim(a.inpatient_no), " +
-            "times=rtrim(a.admiss_times), " +
-            "name=rtrim(a.name), " +
-            "a.sex, " +
-            "deptName=(select rtrim(name) from zd_unit_code where code=a.dis_dept), " +
-            "doctorName=(select rtrim(name) from a_employee_mi where code=b.zyys), " +
-            "lateCount=(select count(*) from batj_ba2 where late_flag=1 and zyys=b.zyys), " +
-            "lateDays=datediff(day, a.dis_date, b.sign_date), " +
-            "disDate=convert(varchar(10), c.start_time, 21) " +
-            "from zy_inactpatient a, batj_ba2 b, yz_act_order c " +
-            "where " +
-            "a.inpatient_no not like 'S%' and " +
-            "a.inpatient_no not like 'JT%' and " +
-            "a.inpatient_no=b.zyh and " +
-            "a.admiss_times=b.zycs and " +
-            "a.inpatient_no=c.inpatient_no and " +
-            "a.admiss_times=c.admiss_times and " +
-            "c.start_time>=#{start} and " +
-            "c.start_time<=#{end} and " +
-            "c.order_code in ('06026','06053','06027', '05973') and " +
-            "c.exec_unit like #{ward} and " +
-            "isnull(a.file_status, 0)=#{fileStatus} and " +
-            "a.inpatient_no like #{bah} and " +
-            "isnull(b.late_flag, '') like #{lateFlag} and " +
-            "charindex('$',a.inpatient_no)=0 " +
-            "order by bedNo ")
-    List<SheetOverview> getOutPatientsForBas(GetOutSheetParam param);
-
     @Select("select " +
             "healthCardNo=rtrim(health_card_no), " +
             "bah=rtrim(inpatient_no), " +
@@ -705,6 +587,8 @@ public interface CaseFrontSheetDao {
             "a.sex, " +
             "admissDept=(select rtrim(name) from zd_unit_code where code=a.admiss_dept), " +
             "dismissDept=(select rtrim(name) from zd_unit_code where code=a.dis_dept), " +
+            "doctorName=(select rtrim(name) from a_employee_mi where code=b.zyys), " +
+            "signDate=(convert(varchar(10), b.sign_date, 21)), " +
             "rtrim(b.blfx) blfx, " +
             "disDate=(convert(varchar(19), a.dis_date, 21))," +
             "inDays=(select datediff(day, a.admiss_date, a.dis_date)), " +
@@ -713,17 +597,19 @@ public interface CaseFrontSheetDao {
             "where " +
             "b.zyh=a.inpatient_no and " +
             "b.zycs=a.admiss_times and " +
-            "a.dis_date>=#{startDate} and " +
-            "a.dis_date<=#{endDate} and " +
+            "a.dis_date>=#{start} and " +
+            "a.dis_date<=#{end} and " +
             "(a.refer_physician like #{doctorCode} or b.zyys like #{doctorCode}) and " +
             "a.sex like #{sex}")
-    List<AdvanceOverview> pureAdvanceSearch(AdvanceSearchParam param);
+    List<SheetOverview> pureAdvanceSearch(AdvanceSearchParam param);
 
     @Select("select " +
             "rtrim(a.inpatient_no) bah, " +
             "a.admiss_times times, " +
             "rtrim(a.name) name, " +
             "a.sex, " +
+            "doctorName=(select rtrim(name) from a_employee_mi where code=b.zyys), " +
+            "signDate=(convert(varchar(10), b.sign_date, 21)), " +
             "disDate=(convert(varchar(19), a.dis_date, 21))," +
             "admissDept=(select rtrim(name) from zd_unit_code where code=a.admiss_dept), " +
             "dismissDept=(select rtrim(name) from zd_unit_code where code=a.dis_dept), " +
@@ -734,8 +620,8 @@ public interface CaseFrontSheetDao {
             "where " +
             "b.zyh=a.inpatient_no and " +
             "b.zycs=a.admiss_times and " +
-            "a.dis_date>=#{startDate} and " +
-            "a.dis_date<=#{endDate} and " +
+            "a.dis_date>=#{start} and " +
+            "a.dis_date<=#{end} and " +
             "(a.refer_physician like #{doctorCode} or b.zyys like #{doctorCode}) and " +
             "a.sex like #{sex} and " +
             "c.inpatient_no=a.inpatient_no and " +
@@ -744,13 +630,15 @@ public interface CaseFrontSheetDao {
             "d.zyh=a.inpatient_no and " +
             "d.zycs=a.admiss_times and " +
             "d.ssbm like #{surgeryCode}")
-    List<AdvanceOverview> maxAdvanceSearch(AdvanceSearchParam param);
+    List<SheetOverview> maxAdvanceSearch(AdvanceSearchParam param);
 
     @Select("select " +
             "rtrim(a.inpatient_no) bah, " +
             "a.admiss_times times, " +
             "rtrim(a.name) name, " +
             "a.sex, " +
+            "doctorName=(select rtrim(name) from a_employee_mi where code=b.zyys), " +
+            "signDate=(convert(varchar(10), b.sign_date, 21)), " +
             "disDate=(convert(varchar(19), a.dis_date, 21))," +
             "admissDept=(select rtrim(name) from zd_unit_code where code=a.admiss_dept), " +
             "dismissDept=(select rtrim(name) from zd_unit_code where code=a.dis_dept), " +
@@ -761,14 +649,14 @@ public interface CaseFrontSheetDao {
             "where " +
             "b.zyh=a.inpatient_no and " +
             "b.zycs=a.admiss_times and " +
-            "a.dis_date>=#{startDate} and " +
-            "a.dis_date<=#{endDate} and " +
+            "a.dis_date>=#{start} and " +
+            "a.dis_date<=#{end} and " +
             "(a.refer_physician like #{doctorCode} or b.zyys like #{doctorCode}) and " +
             "a.sex like #{sex} and " +
             "c.inpatient_no=a.inpatient_no and " +
             "c.admiss_times=a.admiss_times and " +
             "c.dis_diag like #{icdCode}")
-    List<AdvanceOverview> advanceSearchWithIcd(AdvanceSearchParam param);
+    List<SheetOverview> advanceSearchWithIcd(AdvanceSearchParam param);
 
     @Select("select " +
             "rtrim(a.inpatient_no) bah, " +
@@ -776,6 +664,8 @@ public interface CaseFrontSheetDao {
             "rtrim(a.name) name, " +
             "disDate=(convert(varchar(19), a.dis_date, 21))," +
             "a.sex, " +
+            "doctorName=(select rtrim(name) from a_employee_mi where code=b.zyys), " +
+            "signDate=(convert(varchar(10), b.sign_date, 21)), " +
             "admissDept=(select rtrim(name) from zd_unit_code where code=a.admiss_dept), " +
             "dismissDept=(select rtrim(name) from zd_unit_code where code=a.dis_dept), " +
             "rtrim(b.blfx) blfx, " +
@@ -785,12 +675,12 @@ public interface CaseFrontSheetDao {
             "where " +
             "b.zyh=a.inpatient_no and " +
             "b.zycs=a.admiss_times and " +
-            "a.dis_date>=#{startDate} and " +
-            "a.dis_date<=#{endDate} and " +
+            "a.dis_date>=#{start} and " +
+            "a.dis_date<=#{end} and " +
             "(a.refer_physician like #{doctorCode} or b.zyys like #{doctorCode}) and " +
             "a.sex like #{sex} and " +
             "d.zyh=a.inpatient_no and " +
             "d.zycs=a.admiss_times and " +
             "d.ssbm like #{surgeryCode}")
-    List<AdvanceOverview> advanceSearchWithSurgery(AdvanceSearchParam param);
+    List<SheetOverview> advanceSearchWithSurgery(AdvanceSearchParam param);
 }

+ 4 - 0
src/main/java/thyyxxk/webserver/dao_his/casefrontsheet/SheetCreatedDao.java

@@ -17,6 +17,10 @@ public interface SheetCreatedDao {
             "AND (b.dept_code=a.small_dept or b.dept_code=a.dept)")
     List<PureCodeName> getUserWards(@Param("code") String code);
 
+    @Select("select rtrim(dept_code) code, rtrim(dept_name) name from zy_adtward " +
+            "where dept_code not like '8%' order by dept_code")
+    List<PureCodeName> getAllWards();
+
     @Select("select rtrim(code) code, rtrim(name) name from zd_marital_status order by code")
     List<PureCodeName> getMarriageCode();
 

+ 6 - 2
src/main/java/thyyxxk/webserver/pojo/casefrontsheet/AdvanceSearchParam.java

@@ -6,8 +6,12 @@ import lombok.Data;
 public class AdvanceSearchParam {
     private String doctorCode;
     private String sex;
-    private String startDate;
-    private String endDate;
+    private String start;
+    private String end;
     private String icdCode;
     private String surgeryCode;
+
+    public String getSex() {
+        return null == sex ? "" : (sex).trim();
+    }
 }

+ 17 - 1
src/main/java/thyyxxk/webserver/pojo/casefrontsheet/GetOutSheetParam.java

@@ -8,6 +8,22 @@ public class GetOutSheetParam {
     private String end;
     private String ward;
     private Integer fileStatus; // 0,未签收   1,已签收   2,已打印
-    private String lateFlag; // 0,非迟交   1,迟交   3,全部
+    private Integer lateFlag; // 0,非迟交   1,迟交   3,全部
     private String bah;
+
+    public String getStart() {
+        return null == start ? "" : (start).trim();
+    }
+
+    public String getEnd() {
+        return null == end ? "" : (end).trim();
+    }
+
+    public String getWard() {
+        return null == ward ? "" : (ward).trim();
+    }
+
+    public String getBah() {
+        return null == bah ? "" : (bah).trim();
+    }
 }

+ 5 - 0
src/main/java/thyyxxk/webserver/pojo/casefrontsheet/SheetOverview.java

@@ -16,9 +16,14 @@ public class SheetOverview {
     private String signDate;
     private Integer lateCount;
     private Integer lateDays;
+    private Integer lateFlag;
 
     public Integer getLateDays() {
         if (null == lateDays) return 0;
         return Math.max(lateDays - 8, 0);
     }
+
+    public Integer getLateFlag() {
+        return null == lateFlag ? 0 : lateFlag;
+    }
 }

+ 49 - 13
src/main/java/thyyxxk/webserver/service/casefrontsheet/CaseFrontSheetService.java

@@ -5,6 +5,7 @@ import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import thyyxxk.webserver.config.exception.ExceptionEnum;
+import thyyxxk.webserver.dao_his.casefrontsheet.BasSelectOverviewDao;
 import thyyxxk.webserver.dao_his.casefrontsheet.CaseFrontSheetDao;
 import thyyxxk.webserver.dao_his.casefrontsheet.SheetCreatedDao;
 import thyyxxk.webserver.pojo.ResultVo;
@@ -29,10 +30,12 @@ public class CaseFrontSheetService {
     private static ConcurrentHashMap<String, List<PureCodeName>> allDictionary;
     private final CaseFrontSheetDao dao;
     private final SheetCreatedDao createdDao;
+    private final BasSelectOverviewDao basDao;
 
-    public CaseFrontSheetService(SheetCreatedDao createdDao, CaseFrontSheetDao dao) {
+    public CaseFrontSheetService(SheetCreatedDao createdDao, CaseFrontSheetDao dao, BasSelectOverviewDao basDao) {
         this.dao = dao;
         this.createdDao = createdDao;
+        this.basDao = basDao;
         if (allDictionary == null) {
             allDictionary = new ConcurrentHashMap<>();
         }
@@ -94,6 +97,10 @@ public class CaseFrontSheetService {
         return ResultVoUtil.success(list);
     }
 
+    public ResultVo<List<PureCodeName>> getAllWards() {
+        return ResultVoUtil.success(createdDao.getAllWards());
+    }
+
     public ResultVo<List<SheetOverview>> getPatientOverview(String ward) {
         log.info("病案首页获取在院病人>>> {}", ward);
         return ResultVoUtil.success(dao.getPatientOverview(ward));
@@ -111,22 +118,50 @@ public class CaseFrontSheetService {
         if (!param.getWard().equals("")) {
             int cd = dao.getCDBlfxCount(param.getWard());
             int all = dao.getAllDisPatientCount(param.getWard());
-            ret.setCdPercentage(DecimalUtil.getPercent(cd, all));
+            if (cd == 0 || all == 0) {
+                ret.setCdPercentage("0.00%");
+            } else {
+                ret.setCdPercentage(DecimalUtil.getPercent(cd, all));
+            }
+            log.info("科室【{}】CD型病例比例:{}", param.getWard(), ret.getCdPercentage());
         }
+        param.setStart(param.getStart() + " 00:00:00");
         param.setEnd(param.getEnd() + " 23:59:59");
-        param.setWard(param.getWard() + "%");
-        param.setBah(param.getBah() + "%");
-        param.setLateFlag(param.getLateFlag() + "%");
         log.info("病案室获取病人列表>>> {}", param);
-        if (param.getFileStatus() == 1) {
-            List<SheetOverview> list = dao.getOutPatientsForBas(param);
-            param.setFileStatus(2);
-            List<SheetOverview> list1 = dao.getOutPatientsForBas(param);
-            list.addAll(list1);
+        List<SheetOverview> list;
+        if (!param.getBah().equals("")) {
+            if (param.getFileStatus() == 0) {
+                list = basDao.selectPatientsForBasByBah(param);
+            } else {
+                list = basDao.selectPatientsForBasByBah2(param);
+            }
+            if (param.getLateFlag() != 3) {
+                list.removeIf(item -> !item.getLateFlag().equals(param.getLateFlag()));
+            }
             ret.setList(list);
+            return ResultVoUtil.success(ret);
+        }
+        if (!param.getWard().equals("")) {
+            if (param.getFileStatus() == 0) {
+                list = basDao.selectPatientsForBasByWard(param);
+            } else {
+                list = basDao.selectPatientsForBasByWard2(param);
+            }
+            if (param.getLateFlag() != 3) {
+                list.removeIf(item -> !item.getLateFlag().equals(param.getLateFlag()));
+            }
+            ret.setList(list);
+            return ResultVoUtil.success(ret);
+        }
+        if (param.getFileStatus() == 0) {
+            list = basDao.selectPatientsForBasByFileStatus(param);
         } else {
-            ret.setList(dao.getOutPatientsForBas(param));
+            list = basDao.selectPatientsForBasByFileStatus2(param);
+        }
+        if (param.getLateFlag() != 3) {
+            list.removeIf(item -> !item.getLateFlag().equals(param.getLateFlag()));
         }
+        ret.setList(list);
         return ResultVoUtil.success(ret);
     }
 
@@ -298,7 +333,7 @@ public class CaseFrontSheetService {
         dao.writeBaOpLog(param);
         log.info("写入病案操作日志, 操作员:{} >>> 住院号:{}, 住院次数:{}, 操作编码:{}",
                 param.getCode(), param.getBah(), param.getAdmissTimes(), param.getOpType());
-        return ResultVoUtil.success("解除成功。");
+        return ResultVoUtil.success("已成功解除签收。");
     }
 
     public ResultVo<String> infoVerification(SheetInfo info) {
@@ -402,7 +437,8 @@ public class CaseFrontSheetService {
         return ResultVoUtil.success();
     }
 
-    public ResultVo<List<AdvanceOverview>> advanceSearch(AdvanceSearchParam param) {
+    public ResultVo<List<SheetOverview>> advanceSearch(AdvanceSearchParam param) {
+        log.info("高级条件检索:{}", param);
         param.setDoctorCode(param.getDoctorCode() + "%");
         param.setSex(param.getSex() + "%");
         if (param.getIcdCode().equals("") && param.getSurgeryCode().equals("")) {