Browse Source

费用清单弃用存储过程,添加账页号参数

lighter 6 months ago
parent
commit
47fd97f3e9

+ 34 - 5
src/main/java/thyyxxk/webserver/dao/his/inpatient/ChargeListDao.java

@@ -39,15 +39,44 @@ public interface ChargeListDao {
     BriefPatInfo selectBriefPatInfo(String patNo, int times, String table);
 
     @Select("execute zy_receive_drug #{patNo},#{times},#{patNo},'0';" +
-            "execute zy_receive_one #{patNo},#{times},#{patNo},'0';" +
-            "execute dbo.zy_cxtj_mxqd_new #{patNo},#{times}")
-    List<ChargeItem> selectChargeList(String patNo, int times);
+            "execute zy_receive_one #{patNo},#{times},#{patNo},'0';")
+    List<ChargeItem> receiveCharges(String patNo, int times);
 
     @Select("execute dbo.zy_cxtj_mxqd_new #{patNo},#{times}")
-    List<ChargeItem> selectChargeList2(String patNo, int times);
+    List<ChargeItem> selectChargeList(String patNo, int times);
+
+    
+    @Select("<script>" +
+            "select " +
+            "code=case when isnull(nullif(serial,''),'00')='00' then " +
+            "(select national_code from zd_charge_item d where d.code=charge_code_mx) else " +
+            "(select max(national_code) from yp_zd_dict d where d.code=charge_code_mx) end, " +
+            "name=case when isnull(nullif(serial,''),'00')='00' then " +
+            "(select name from zd_charge_item d where d.code=charge_code_mx) else " +
+            "(select max(name) from yp_zd_dict d where d.code=charge_code_mx) end, " +
+            "specification=case when isnull(nullif(serial,''),'00')='00' then null else " +
+            "(select max(specification) from yp_zd_dict d where d.code=charge_code_mx) end, " +
+            "unit=case when isnull(nullif(serial,''),'00')='00' then " +
+            "(select d.charge_unit from zd_charge_item d where d.code=charge_code_mx) else " +
+            "(select name from yp_zd_unit e where e.code= " +
+            "(select d.pack_unit from yp_zd_dict d where d.code=charge_code_mx and d.serial=a.serial)) end, " +
+            "price=abs(round(charge_fee/case when charge_amount=0 then 1 else charge_amount end,2)), " +
+            "quantity=a.charge_amount,cost=charge_fee, " +
+            "execDept=(select d.name from zd_unit_code d where d.code= " +
+            "(case when isnull(exec_unit,'')='' then ward_code else exec_unit end)), " +
+            "billItemCode=case when isnull(nullif(serial,''),'00')='00' then " +
+            "(select d.bill_item_zy from zd_charge_item d where d.code=charge_code_mx) else " +
+            "(select max(d.bill_item_zy) from yp_zd_dict d where d.code=charge_code_mx) end " +
+            "from zy_detail_charge a where inpatient_no=#{patNo} and admiss_times=#{times} " +
+            "<if test=\"ledgerSn != null \">" +
+            "and ledger_sn=#{ledgerSn} and charge_amount!=0 " +
+            "</if>" +
+            "and trans_flag_yb!=2 " +
+            "</script>")
+    List<ChargeItem> getChargeList(PatOverview overview);
 
     @Select("select count(1) from zy_actpatient where inpatient_no=#{patNo} and admiss_times=#{times}")
-    Integer isDischargedPatients(String patNo, int times);
+    Integer isDischargedPatients(PatOverview overview);
 
     @Select("select count(1) from zy_actpatient where inpatient_no=#{patNo} and admiss_times=#{times}")
     int selectInhospCount(String patNo, int times);

+ 3 - 0
src/main/java/thyyxxk/webserver/dao/his/redislike/RedisLikeDao.java

@@ -26,6 +26,9 @@ public interface RedisLikeDao {
             "a_employee_mi a, zd_unit_code b where a.code=#{code} and b.code=a.dept_code")
     CodeName selectUserDept(String code);
 
+    @Select("select name from zy_bill_item where code=#{code}")
+    String selectBillItemName(String code);
+
     @Select("select (select rtrim(t.name) from zd_unit_code t where t.code=dept_code ) + '-' + " +
             "rtrim(name) from a_employee_mi with(nolock) where code=#{code}")
     String selectDeptAndUser(String code);

+ 11 - 0
src/main/java/thyyxxk/webserver/entity/inpatient/chargelist/ChargeItem.java

@@ -7,16 +7,27 @@ import java.math.RoundingMode;
 
 @Data
 public class ChargeItem {
+    // 医保编码
     private String code;
+    // 医保名称
     private String name;
+    // 规格
     private String specification;
+    // 单位
     private String unit;
+    // 单价
     private BigDecimal price;
+    // 数量
     private BigDecimal quantity;
+    // 金额
     private BigDecimal cost;
+    // 执行科室
     private String execDept;
+    // 费用类别编码
     private String billItemCode;
+    // 费用类别名称
     private String billItemName;
+
     private String priceString;
     private String quantityString;
     private String costString;

+ 1 - 0
src/main/java/thyyxxk/webserver/entity/inpatient/chargelist/PatOverview.java

@@ -11,6 +11,7 @@ import java.util.Date;
 public class PatOverview {
     private String patNo;
     private Integer times;
+    private Integer ledgerSn;
     private BigDecimal totalCharge;
     private String name;
     @DateTimeFormat(pattern = "yyyy-MM-dd")

+ 12 - 5
src/main/java/thyyxxk/webserver/service/inpatient/ChargeListService.java

@@ -79,12 +79,19 @@ public class ChargeListService {
     }
 
     public Map<String, Object> selectChargeList(PatOverview overview) {
+//        List<ChargeItem> chargeList;
+//        if (dao.isDischargedPatients(overview.getPatNo(), overview.getTimes()) > 0) {
+//            chargeList = dao.selectChargeList(overview.getPatNo(), overview.getTimes());
+//        } else {
+//            chargeList = dao.selectChargeList2(overview.getPatNo(), overview.getTimes());
+//        }
 
-        List<ChargeItem> chargeList;
-        if (dao.isDischargedPatients(overview.getPatNo(), overview.getTimes()) > 0) {
-            chargeList = dao.selectChargeList(overview.getPatNo(), overview.getTimes());
-        } else {
-            chargeList = dao.selectChargeList2(overview.getPatNo(), overview.getTimes());
+        if (dao.isDischargedPatients(overview) > 0) {
+            dao.receiveCharges(overview.getPatNo(), overview.getTimes());
+        }
+        List<ChargeItem> chargeList = dao.getChargeList(overview);
+        for (ChargeItem item : chargeList) {
+            item.setBillItemName(redis.getBillItemName(item.getBillItemCode()));
         }
 
         Map<String, List<ChargeItem>> chargeListMap = new HashMap<>();

+ 13 - 0
src/main/java/thyyxxk/webserver/service/redislike/RedisLikeService.java

@@ -47,6 +47,7 @@ public class RedisLikeService {
     private final static Map<String, String> YB_CONTACT_RELATION_MAP = new HashMap<>();
     private final static Map<String, String> YB_DEPT_MAP = new HashMap<>();
     private final static Map<String, String> CODE_RS_MAP = new HashMap<>();
+    private final static Map<String, String> BILL_ITEM_MAP = new HashMap<>();
     public static final Map<String, YzZdOrderItemConfirm> specialMedicalAdvice = new HashMap<>();
     private final RedisLikeDao dao;
     private final YiZhuLuRuDao yzDao;
@@ -117,6 +118,18 @@ public class RedisLikeService {
         return dept;
     }
 
+    public String getBillItemName(String code) {
+        if (StringUtil.invalidValue(code)) {
+            return null;
+        }
+        String billItemName = BILL_ITEM_MAP.get(code);
+        if (null == billItemName) {
+            billItemName = dao.selectBillItemName(code);
+            BILL_ITEM_MAP.put(code, billItemName);
+        }
+        return billItemName;
+    }
+
     public String getRegionName(String code) {
         if (StringUtil.isBlank(code)) {
             return null;