Ver código fonte

优化费用清单

lighter 1 ano atrás
pai
commit
50d098fab9

+ 7 - 1
src/main/java/thyyxxk/webserver/dao/his/inpatient/ChargeListDao.java

@@ -1,11 +1,13 @@
 package thyyxxk.webserver.dao.his.inpatient;
 
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import thyyxxk.webserver.entity.inpatient.chargelist.BriefPatInfo;
 import thyyxxk.webserver.entity.inpatient.chargelist.ChargeItem;
 import thyyxxk.webserver.entity.inpatient.chargelist.PatOverview;
 
+import java.util.Date;
 import java.util.List;
 
 @Mapper
@@ -24,7 +26,7 @@ public interface ChargeListDao {
             "rtrim(a.bed_no) as bedNo,datediff(day,admiss_date,isnull(dis_date,getdate())) as days, " +
             "gender=(case when sex='1' then '男' when sex='2' then '女' else '未知' end), " +
             "rtrim(admiss_dept) as dept,admiss_date as admdate,med_type as medtype, " +
-            "admiss_date as begndate,isnull(dis_date,getdate()) as enddate, " +
+            "admiss_date as begndate,dis_date as enddate, " +
             "balance=(select ((select isnull(sum(t.depo_amount),0) from zy_deposit_file t " +
             "where t.inpatient_no=a.inpatient_no and t.admiss_times=a.admiss_times and t.status in (1,2)) + " +
             "(select sum(e.fund_pay_sumamt) from zy_ledger_file e where e.inpatient_no=#{patNo} and e.admiss_times=#{times}) - " +
@@ -46,4 +48,8 @@ public interface ChargeListDao {
 
     @Select("select ledger_sn from zy_ledger_file where inpatient_no=#{patNo} and admiss_times=#{times} and ledger_sn>0")
     List<Integer> selectAllLedgers(String patNo, int times);
+
+    @Select("select start_time from yz_act_order where inpatient_no=#{patNo} and admiss_times=#{times} " +
+            "and status_flag > '1' and isnull(group_no, '00')='00' and order_code in ('06026','06053','05973')")
+    Date selectActOrderDisDate(@Param("patNo") String patNo, @Param("times") Integer times);
 }

+ 9 - 4
src/main/java/thyyxxk/webserver/service/inpatient/ChargeListService.java

@@ -18,10 +18,7 @@ import thyyxxk.webserver.utils.ResultVoUtil;
 
 import java.math.BigDecimal;
 import java.math.RoundingMode;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 @Slf4j
 @Service
@@ -55,6 +52,14 @@ public class ChargeListService {
             if (briefPatInfo.getDays() < 1) {
                 briefPatInfo.setDays(1);
             }
+            if (null == briefPatInfo.getEnddate()) {
+                Date disdate = dao.selectActOrderDisDate(overview.getPatNo(), overview.getTimes());
+                if (null == disdate) {
+                    briefPatInfo.setEnddate(new Date());
+                } else {
+                    briefPatInfo.setEnddate(disdate);
+                }
+            }
         }
         return briefPatInfo;
     }