Browse Source

住院电子发票优化

lihong 5 months ago
parent
commit
6e7f549124

+ 7 - 0
src/main/java/thyyxxk/webserver/dao/his/inpatient/charge/CashierProcessDao.java

@@ -305,6 +305,9 @@ public interface CashierProcessDao {
     @Update(" update zy_receipt set receipt_no =case when #{printFlag} ='1' then #{receiptNo} else receipt_no end , print_date =getdate ( ) where inpatient_no =#{inpatientNo} and admiss_times =#{admissTimes} and ledger_sn =#{ledgerSn} and ( case when 1 > 0 then receipt_sn else 1 end ) =1 ")
     int updatezyReceipt(PatientParam param);
 
+    @Update(" update zy_receipt set dzfp_receipt_no =#{receiptNo} , print_date =getdate ( ) where inpatient_no =#{inpatientNo} and admiss_times =#{admissTimes} and ledger_sn =#{ledgerSn} and ( case when 1 > 0 then receipt_sn else 1 end ) =1 ")
+    int updatezyReceiptDzfpNo(PatientParam param);
+
     @Select(" SELECT a.inpatient_no, " +
             "       a.admiss_times, " +
             "       a.ledger_sn, " +
@@ -620,4 +623,8 @@ public interface CashierProcessDao {
     ZyActpatient selectZyActpatientFeeDetail(PatientParam param);
     @Select(" select max ( ledger_sn ) maxLedgerSn , min ( ledger_sn ) minLedgerSn  from zy_ledger_file where inpatient_no =#{inpatientNo} and admiss_times =#{admissTimes}  ")
     Map<String,Object> selectMaxAndMinLedgerSn(PatientParam param);
+    @Select(" select fp_no from mz_dzfp_upload where del_flag = 0 and  type_flag = #{typeFlag} and patient_id = #{inpatientNo} and times = #{admissTimes} and receipt_no = #{ledgerSn} ")
+    String selectDzfpNo(PatientParam param);
+    @Update("update zy_receipt set dzfp_receipt_no =null  where inpatient_no =#{inpatientNo} and admiss_times =#{admissTimes} and ledger_sn =#{ledgerSn} and ( case when 1 > 0 then receipt_sn else 1 end ) =1 ")
+    void clearZyReceiptDzfpNo(PatientParam param);
 }

+ 1 - 1
src/main/java/thyyxxk/webserver/dao/his/medicalinsurance/UpIdCollectionDao.java

@@ -261,7 +261,7 @@ public interface UpIdCollectionDao extends BaseMapper<SetlinfoUpld> {
             "where zyh = #{patNo} and zycs = #{times} " + "order by ssxh")
     List<OprninfoUpld> oprninfoUplds(@Param("patNo") String patNo, @Param("times") Integer times, @Param("tableName") String tableName);
 
-    @Select("select rtrim(receipt_no) receipt_no  from zy_receipt where inpatient_no=#{patNo} and admiss_times=#{times} and ledger_sn=#{ledgerSn} and receipt_no<>'00000000'" + "and receipt_sn = 1")
+    @Select("select  case when isnull(dzfp_receipt_no,'') !='' then dzfp_receipt_no else  rtrim(receipt_no) end receipt_no  from zy_receipt where inpatient_no=#{patNo} and admiss_times=#{times} and ledger_sn=#{ledgerSn} and receipt_no<>'00000000'" + "and receipt_sn = 1")
     String billNo(@Param("patNo") String patNo, @Param("times") Integer times, @Param("ledgerSn") Integer ledgerSn);
 
     @Select("select top 1  receipt_bill " +

+ 2 - 0
src/main/java/thyyxxk/webserver/entity/inpatient/charge/ZyReceipt.java

@@ -143,6 +143,8 @@ public class ZyReceipt  implements Serializable {
     private String doctor;
     /** 住院流水号 */
     private String zySerialNo;
+    /** 电子发票号码 */
+    private String dzfpReceiptNo;
 
 
 

+ 16 - 1
src/main/java/thyyxxk/webserver/service/inpatient/charge/CashierProcessService.java

@@ -31,7 +31,6 @@ import thyyxxk.webserver.utils.CommonUtil;
 import thyyxxk.webserver.utils.ResultVoUtil;
 import thyyxxk.webserver.utils.TokenUtil;
 
-import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.util.Date;
@@ -490,6 +489,22 @@ public class CashierProcessService {
         if(response.getCode() == -1 ){
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_HTML_ERROR, response.getMessage());
         }
+        if(Convert.toInt(NumberEnum.ThREE.getCode()).equals(param.getTypeFlag())){
+           String dzfpNo =  dao.selectDzfpNo(param);
+           if(StrUtil.isNotBlank(dzfpNo)){
+               param.setReceiptNo(dzfpNo);
+               dao.updateZyLedgerFileReceiptNo(param);
+               dao.updateZyDepositFileReceiptNo(param);
+               dao.updatezyReceiptDzfpNo(param);
+           }else {
+           //    查询是否有冲红的发票
+               param.setTypeFlag(4);
+               String zfDzfpNo =  dao.selectDzfpNo(param);
+               if(StrUtil.isNotBlank(zfDzfpNo)){
+                   dao.clearZyReceiptDzfpNo(param);
+               }
+           }
+        }
         return ResultVoUtil.success(ExceptionEnum.SUCCESS, (Map)response.getData());
     }