Kaynağa Gözat

费用上传过滤拆零

yeguodong 1 gün önce
ebeveyn
işleme
9d2379e204

+ 17 - 12
src/main/java/thyyxxk/simzfeeoprnsystm/dao/SiMzDao.java

@@ -68,20 +68,22 @@ public interface SiMzDao {
             "where pat_no=#{patNo} and times=#{times} ")
     void afterRegistrtn(MzPatientInfo p);
 
-    @Select("select feedetlSn=(patient_id + '_' + cast(times as varchar) + '_' + cast(receipt_no as varchar) + '_' + " +
-            "cast(order_no as varchar) + '_' + cast(item_no as varchar)), " +
-            "receipt_no as rxno, input_date as feeOcurTime, " +
+    @Select("select feedetlSn=(t.patient_id + '_' + cast(t.times as varchar) + '_' + cast(t.receipt_no as varchar) + '_' + " +
+            "cast(t.order_no as varchar) + '_' + cast(t.item_no as varchar)), " +
+            "t.receipt_no as rxno, t.input_date as feeOcurTime, " +
             "medListCodg=isnull((select max(national_code) from yp_zd_dict where code=his_item_code), " +
             "(select max(national_code) from zd_charge_item where code=his_item_code)), " +
-            "his_item_code as medinsListCodg, " +
-            "charge_fee as detItemFeeSumamt, " +
-            "quantity as cnt, price as pric, " +
-            "hospApprFlag=isnull(hosp_appr_flag, 0), " +
+            "t.his_item_code as medinsListCodg, " +
+            "t.charge_fee as detItemFeeSumamt, " +
+            "t.quantity as cnt, price as pric, " +
+            "hospApprFlag=isnull(t.hosp_appr_flag, 0), " +
             "bilgDrCodg=(select rtrim(yb_code) from a_employee_mi where code=input_staff), " +
             "ordersDrCode=(select rtrim(yb_code) from a_employee_mi where code=input_staff), " +
             "ybName=(select rtrim(yb_name) from a_employee_mi where code=input_staff), " +
-            "input_man as bilgDrName,input_man as ordersDrName " +
-            "from t_mt_receipt where patient_id=#{patNo} and times=#{times} and yb_trans_flag=0 ")
+            "t.input_man as bilgDrName, t.input_man as ordersDrName " +
+            "from t_mt_receipt t " +
+            "left join mz_charge_detail m on m.patient_id=t.patient_id and m.times=t.times and m.charge_item_code=t.his_item_code " +
+            "where t.patient_id=#{patNo} and t.times=#{times} and t.yb_trans_flag=0 and m.serial != '01' ")
     List<FeeDetail> selectOutpatientFees(String patNo, int times);
 
     @Update("update t_mt_receipt set yb_trans_flag=1,chrgitm_lv=#{chrgLv},med_chrgitm_type=#{chrgType} where " +
@@ -94,8 +96,9 @@ public interface SiMzDao {
 
     @Select("select psn_no,insuplc_admdvs,mdtrtCertType='02',certno as mdtrtCertNo,certno, " +
             "psn_cert_type,psn_type,psn_name,med_type,mdtrt_id,insutype, " +
-            "medfeeSumamt=(select sum(t.charge_fee) from t_mt_receipt t where " +
-            "t.patient_id=#{patNo} and t.times=#{times}) " +
+            "medfeeSumamt=(select sum(t.charge_fee) from t_mt_receipt t " +
+            "left join mz_charge_detail m on m.patient_id=t.patient_id and m.times=t.times and m.charge_item_code=t.his_item_code " +
+            "where t.patient_id=#{patNo} and t.times=#{times} and m.serial != '01') " +
             "from t_si_pat_info where pat_no=#{patNo} and times=#{times}")
     MzPreSetlmt selectPreSetlmt(String patNo, int times);
 
@@ -128,7 +131,9 @@ public interface SiMzDao {
 
     @Select("select psn_no,certno as mdtrtCertNo,mdtrtCertType='02', " +
             "psn_cert_type,certno,med_type,insuplc_admdvs, " +
-            "medfeeSumamt=(select sum(charge_fee) from t_mt_receipt where patient_id=#{patNo} and t_mt_receipt.times=#{times}), " +
+            "medfeeSumamt=(select sum(t.charge_fee) from t_mt_receipt t " +
+            "left join mz_charge_detail m on m.patient_id=t.patient_id and m.times=t.times and m.charge_item_code=t.his_item_code " +
+            "where t.patient_id=#{patNo} and t.times=#{times} and m.serial != '01') " +
             "mdtrt_id,insutype,fulamt_ownpay_amt,overlmt_amt as overlmtSelfpay, " +
             "preselfpay_amt,inscp_scp_amt " +
             "from t_si_pat_info where pat_no=#{patNo} and times=#{times}")