瀏覽代碼

优化门诊收费报表超过三种支付方式只会显示一个支付方式缺陷

hurugang 2 年之前
父節點
當前提交
756880bce7

+ 14 - 7
src/main/java/cn/hnthyy/thmz/mapper/his/mz/ChargeFeeVoMapper.java

@@ -72,18 +72,25 @@ public interface ChargeFeeVoMapper {
      */
     @Select("   select " +
             "   patient_id=rtrim(m.patient_id), " +
+            "   times=m.times," +
+            "   receipt_no=m.receipt_no,"+
             "  serial_no =m.serial_no, " +
             "   total_charge=isnull(m.amount,0), " +
             "   m.pay_mark," +
             "    charge_date=m.charge_date," +
-            "  r.receipt_bill," +
-            "   receipt_sn=r.receipt_sn , " +
+       //     "  r.receipt_bill," +
+       //     "   receipt_sn=r.receipt_sn , " +
             "   m.cheque_type, " +
-            "   m.op_id,m.contract_id from mz_deposit_file m WITH(NOLOCK) left join mz_receipt_serial  r WITH(NOLOCK) on m.serial_no =r.serial_no and m.cheque_type=r.cheque_type where  " +
-            "   case '1' when #{caseType} then r.charge_date else  m.dcount_date end =#{dcountDate,jdbcType=TIMESTAMP}  " +
-            "  and r.pay_mark <> 2 and m.cheque_type <>'Z' " +
-            "  group by r.receipt_sn,r.receipt_bill,m.cheque_type,m.pay_mark,m.op_id,m.contract_id,m.charge_date,m.patient_id,m.serial_no,isnull(( m.amount ), 0 ) " +
-            "   order by abs(r.receipt_sn),r.receipt_bill")
+            "   m.op_id,m.contract_id from mz_deposit_file m WITH(NOLOCK)" +
+      //      " left join mz_receipt_serial  r WITH(NOLOCK) on m.serial_no =r.serial_no and m.cheque_type=r.cheque_type" +
+            " where  " +
+            "   case '1' when #{caseType} then m.charge_date else  m.dcount_date end =#{dcountDate,jdbcType=TIMESTAMP}  " +
+            "  and m.pay_mark <> 2 and m.cheque_type <>'Z' " +
+          //  " and  m.patient_id='12117-4' " +
+            "  group by " +
+           // " r.receipt_sn,r.receipt_bill," +
+            "m.cheque_type,m.pay_mark,m.op_id,m.contract_id,m.charge_date,m.patient_id,m.serial_no,isnull(( m.amount ), 0 ),m.times,m.receipt_no " +
+            "   order by abs(m.serial_no)")
     List<ChargeFeeVo> selectChargeFeeVoReprint(@Param("userIdCode") String userIdCode, @Param("caseType") String caseType, @Param("dcountDate") Date dcountDate);
 
     /**

+ 5 - 7
src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzReceiptSerialMapper.java

@@ -201,14 +201,12 @@ public interface MzReceiptSerialMapper {
      * @param receiptNo
      * @return
      */
-    @Select({"<script>",
-            "select rtrim(patient_id) patient_id,times,receipt_no,serial_no,rtrim(operator_id) operator_id,charge1,charge2,charge3,charge4,charge5,charge6,charge7,charge8,charge9,",
-            "charge10,charge11,charge12,charge13,charge14,charge15,charge16,charge17,charge18,charge19,charge20,rtrim(pay_mark) pay_mark,total_charge,charge_date,rtrim(receipt_bill) receipt_bill,",
+    @Select("select rtrim(patient_id) patient_id,times,receipt_no,serial_no,rtrim(operator_id) operator_id,charge1,charge2,charge3,charge4,charge5,charge6,charge7,charge8,charge9,"+
+            "charge10,charge11,charge12,charge13,charge14,charge15,charge16,charge17,charge18,charge19,charge20,rtrim(pay_mark) pay_mark,total_charge,charge_date,rtrim(receipt_bill) receipt_bill,"+
             "receipt_sn,dcount_date,rtrim(windows_no) windows_no,dcount_no,serial_yb,rtrim(fp_flag) fp_flag,rtrim(responce_type) responce_type,rtrim(cheque_type) cheque_type,cheque_no," +
-                    "rtrim(tf_flag) tf_flag,dept_no,rtrim(pay_id) pay_id,charge_dcount_date,charge_dcount_no,obsolete_id,obsolete_date,obsolete_dcount_date,obsolete_dcount_no",
-            "from ${tableName} WITH(NOLOCK) where  patient_id=#{patientId,jdbcType=CHAR} and times = #{times,jdbcType=INTEGER} and receipt_no = #{receiptNo,jdbcType=INTEGER} and receipt_bill is not null",
-            "</script>"})
-    MzReceiptSerial selectReceiptBillForThisTime(@Param(value = "patientId") String patientId, @Param("times") Integer times, @Param("receiptNo") Short receiptNo,@Param(value = "tableName") String tableName);
+                    "rtrim(tf_flag) tf_flag,dept_no,rtrim(pay_id) pay_id,charge_dcount_date,charge_dcount_no,obsolete_id,obsolete_date,obsolete_dcount_date,obsolete_dcount_no "+
+            " from mz_receipt_serial WITH(NOLOCK) where  patient_id=#{patientId,jdbcType=CHAR} and times = #{times,jdbcType=INTEGER} and receipt_no = #{receiptNo,jdbcType=INTEGER} and receipt_bill is not null and receipt_bill <> ''")
+    MzReceiptSerial selectReceiptBillForThisTime(@Param(value = "patientId") String patientId, @Param("times") Integer times, @Param("receiptNo") Integer receiptNo);
 
 
     /**

+ 9 - 0
src/main/java/cn/hnthyy/thmz/service/impl/his/mz/ChargeFeeVoServiceImpl.java

@@ -1,5 +1,6 @@
 package cn.hnthyy.thmz.service.impl.his.mz;
 
+import cn.hnthyy.thmz.common.Constants;
 import cn.hnthyy.thmz.entity.his.mz.MzDepositFile;
 import cn.hnthyy.thmz.entity.his.mz.MzReceiptSerial;
 import cn.hnthyy.thmz.entity.thmz.CooperativeEnterprise;
@@ -11,12 +12,14 @@ import cn.hnthyy.thmz.mapper.his.mz.MzReceiptSerialMapper;
 import cn.hnthyy.thmz.mapper.thmz.CooperativeEnterpriseMapper;
 import cn.hnthyy.thmz.service.his.mz.ChargeFeeVoService;
 import cn.hnthyy.thmz.vo.*;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Isolation;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 import java.math.BigDecimal;
+import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
@@ -62,6 +65,12 @@ public class ChargeFeeVoServiceImpl implements ChargeFeeVoService {
     private void setContractName(List<ChargeFeeVo> chargeFeeVoList) {
         if(chargeFeeVoList!=null && chargeFeeVoList.size()>0){
             for(ChargeFeeVo chargeFeeVo:chargeFeeVoList){
+                if(!Arrays.asList(Constants.BYJZ,Constants.YBJZ).contains(chargeFeeVo.getChequeType())){
+                    MzReceiptSerial mzReceiptSerial= mzReceiptSerialMapper.selectReceiptBillForThisTime(chargeFeeVo.getPatientId(),chargeFeeVo.getTimes(),chargeFeeVo.getReceiptNo());
+                    if(mzReceiptSerial!=null && StringUtils.isNotBlank(mzReceiptSerial.getReceiptBill())){
+                        chargeFeeVo.setReceiptBill(mzReceiptSerial.getReceiptBill());
+                    }
+                }
                 if(chargeFeeVo.getContractId()==null){
                     continue;
                 }

+ 4 - 0
src/main/java/cn/hnthyy/thmz/vo/ChargeFeeVo.java

@@ -12,6 +12,10 @@ import java.util.Date;
 public class ChargeFeeVo {
     //病人ID
     private String patientId;
+    //就诊次数
+    private Integer times;
+    //缴费次数
+    private Integer receiptNo;
     //机制号
     private String serialNo;
     //退欠标识