Quellcode durchsuchen

急诊转入问题

DESKTOP-0GD05B0\Administrator vor 2 Jahren
Ursprung
Commit
1a67bf37fc

+ 9 - 9
src/main/java/thyyxxk/webserver/dao/his/inpatient/TransferInOfExpensesDao.java

@@ -53,7 +53,7 @@ public interface TransferInOfExpensesDao {
     @Select("select " +
             "       patient_name =rtrim(a.name), " +
             "       item_name = c.name, " +
-            "       charge_amount = a.quantity, " +
+            "       a.quantity  , " +
             "       self_flag=c.self_flag, " +
             "       separate_flag = c.separate_flag, " +
             "       suppress_flag = c.suppress_flag, " +
@@ -61,13 +61,13 @@ public interface TransferInOfExpensesDao {
             "       charge_code_mx = a.charge_item_code, " +
             "       serial = a.serial, " +
             "       group_no = a.group_no, " +
-            "       price = a.unit_price, " +
-            "       charge_fee=a.unit_price * a.quantity * isnull(a.drug_win,1), " +
+            "        a.unit_price, " +
             "       check_flag='0', " +
             "       warn_dept =a.warn_dept, " +
             "       doctor_code = a.doctor_code, " +
             "       bill_item_code = rtrim(a.bill_item_code), " +
-            "       exec_dept = a.exec_dept " +
+            "       exec_dept = a.exec_dept," +
+            "       a.drug_win " +
             "from ${mzTableName} a,${tableName} b,zd_charge_item c " +
             "where a.patient_id = b.patient_id and " +
             "        a.times = b.times and " +
@@ -79,7 +79,7 @@ public interface TransferInOfExpensesDao {
             "union all " +
             "select patient_name =rtrim(a.name), " +
             "       item_name = (select name from yp_zd_dict where yp_zd_dict.code=c.charge_code and yp_zd_dict.serial=c.serial),/*c.drugname,*/ " +
-            "       charge_amount = a.quantity, " +
+            "       a.quantity, " +
             "       self_flag=a.self_flag, " +
             "       separate_flag =  (select separate_flag from yp_zd_dict where yp_zd_dict.code=c.charge_code and yp_zd_dict.serial=c.serial), " +
             "       suppress_flag =  (select suprice_flag from yp_zd_dict where yp_zd_dict.code=c.charge_code and yp_zd_dict.serial=c.serial), " +
@@ -87,13 +87,13 @@ public interface TransferInOfExpensesDao {
             "       charge_code_mx = a.charge_item_code, " +
             "       serial = a.serial, " +
             "       group_no = a.group_no, " +
-            "       price = a.unit_price, " +
-            "       charge_fee= Convert(decimal(18,2),a.unit_price * a.quantity * isnull(a.drug_win,1)) , " +
+            "       a.unit_price, " +
             "       check_flag='0', " +
             "       warn_dept =a.warn_dept, " +
             "       doctor_code = a.doctor_code, " +
             "       bill_item_code = rtrim(a.bill_item_code), " +
-            "       exec_dept = a.exec_dept " +
+            "       exec_dept = a.exec_dept," +
+            "       a.drug_win " +
             "from ${mzTableName} a,${tableName} b,yp_base_yf c  " +
             "where a.patient_id = b.patient_id and " +
             "        a.times = b.times and " +
@@ -184,7 +184,7 @@ public interface TransferInOfExpensesDao {
             "gen_time,charge_code_mx,serial,doctor_code,trans_flag_yb,refer_physician,consult_physician,exec_unit,zy_serial_no) VALUES " +
             "<foreach collection='list' item='fee' separator=',' open='' close=''>" +
             "(#{info.inpatientNo}, #{info.admissTimes}, #{info.ledgerSn}, #{fee.detailSn}, #{info.chargeDate}, #{info.staffId}, " +
-            "#{fee.chargeCode}, 0, 2, #{fee.chargeAmount}, cast(#{fee.chargeFee,jdbcType=DECIMAL} as decimal(14,5)), #{info.zkWard}, #{info.dept}, 6, " +
+            "#{fee.chargeCode}, 0, 2, #{fee.chargeQuantity}, cast(#{fee.chargeFee,jdbcType=DECIMAL} as decimal(14,5)), #{info.zkWard}, #{info.dept}, 6, " +
             "'',#{info.chargeDate}, #{fee.chargeCodeMx},#{fee.serial},#{fee.doctorCode},0,#{info.referPhysician}," +
             "#{info.consultPhysician},#{info.execUnit},#{info.zySerialNo})" +
             "</foreach>" +

+ 18 - 6
src/main/java/thyyxxk/webserver/entity/datamodify/MzChargeDetail.java

@@ -7,9 +7,9 @@ import thyyxxk.webserver.utils.StringUtil;
 
 import java.io.Serializable;
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.util.Date;
 import java.util.List;
-import java.util.Objects;
 
 @Data
 @JsonInclude(JsonInclude.Include.NON_NULL)
@@ -51,6 +51,8 @@ public class MzChargeDetail implements Serializable {
      */
     private Integer orderNo;
 
+    private BigDecimal drugWin;
+
     /**
      * itemNo
      */
@@ -133,11 +135,6 @@ public class MzChargeDetail implements Serializable {
      */
     private String confirmId;
 
-    /**
-     * drugWin
-     */
-    private BigDecimal drugWin;
-
     /**
      * inputId
      */
@@ -482,6 +479,21 @@ public class MzChargeDetail implements Serializable {
      */
     private String source;
 
+    private BigDecimal chargeQuantity;
+
+    public BigDecimal getChargeQuantity() {
+        return (null == quantity ? BigDecimal.ONE : quantity).multiply(null == drugWin ? BigDecimal.ONE : drugWin);
+    }
+
+    /**
+     * 获取金额
+     *
+     * @return
+     */
+    public BigDecimal getChargeFee() {
+        return getChargeQuantity().multiply(unitPrice == null ? BigDecimal.ZERO : unitPrice).setScale(2, RoundingMode.HALF_UP);
+    }
+
     /**
      * 不知道为什么有这样的数据
      *

+ 1 - 10
src/main/java/thyyxxk/webserver/service/inpatient/TransferInOfExpensesService.java

@@ -142,20 +142,11 @@ public class TransferInOfExpensesService {
         if (DateUtil.shiJianDaXiao(param.getChargeDate(), admissDate, "<")) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "费用发生时间不能小于入院时间.");
         }
-        // 获取 全部的费用
-        BigDecimal sum = new BigDecimal(0);
         // 流水号取出这个患者流水值的最大值 在加 1
         // 同时计算 出患者的总金额 以及 费用的类型
+        list.removeIf(item -> "BILL99".equals(item.getChargeCodeMx()));
         for (MzChargeDetail mzChargeDetail : list) {
-            if (mzChargeDetail.getChargeCodeMx().equals("BILL99")) {
-                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "舍尾金额,无法录入。");
-            }
-            ZyDetailCharge pojo = new ZyDetailCharge();
-            pojo.setChargeAmount(BigDecimal.valueOf(mzChargeDetail.getChargeAmount()).multiply(mzChargeDetail.getChargeFee()));
-            pojo.setAmount(mzChargeDetail.getChargeFee());
-            pojo.setBillItemCode(mzChargeDetail.getBillItemCode());
             mzChargeDetail.setDetailSn(maxDetailSn += 1);
-            sum = sum.add(pojo.getChargeAmount().multiply(pojo.getAmount()));
         }
         dao.insertInfoZyDetailCharge(param, list);
         log.info("急门诊费用插入 --> 操作人:{} , 数据:{}", param.getStaffId(), JSON.toJSONStringWithDateFormat(param, GetDateFormat.DATE_TIME));