|
@@ -1065,12 +1065,6 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
// List<MzChargeDetail> mzChargeDetailList = mzChargeDetailMapper.selectByPatientIdAndTimesAndReceiptNo(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes(), mzDepositFileVo.getReceiptNo());
|
|
|
MzChargeDetail mzChargeDetail = new MzChargeDetail(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes());
|
|
|
mzChargeDetail.setReceiptNo(mzDepositFileVo.getReceiptNo());
|
|
|
-// if (mzChargeDetailList == null || mzChargeDetailList.size() == 0) {
|
|
|
-// // mzChargeDetailMapper.reInsertDetail(mzChargeDetail);
|
|
|
-// //mzChargeDetailMapper.deleteFromBak(mzChargeDetail);
|
|
|
-// mzChargeDetail.setChequType(Constants.BYJZ);
|
|
|
-// mzChargeDetailMapper.updateMzChargeDetailFull(mzChargeDetail);
|
|
|
-// }
|
|
|
//本院记账需要把原缴费记录保存
|
|
|
List<MzChargeDetail> mzChargeDetailList = mzChargeDetailMapper.selectByPatientIdAndTimesAndReceiptNo(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes(), mzDepositFileVo.getReceiptNo());
|
|
|
mzDepositFileService.batchSaveMzDepositFile(newMzDepositFileList);
|
|
@@ -4737,21 +4731,39 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
//添加代金券收费方式
|
|
|
BigDecimal tempTotalFee = totalPayable.subtract(BigDecimal.ZERO);
|
|
|
if(djzAmount.compareTo(BigDecimal.ZERO) == 1){
|
|
|
- addNewDepositFile(fullNewMzDepositFiles,newMzDepositFiles,m,djzAmount,Constants.DJZ);
|
|
|
tempTotalFee = tempTotalFee.subtract(djzAmount);
|
|
|
+ if(tempTotalFee.compareTo(BigDecimal.ZERO) >=0){
|
|
|
+ addNewDepositFile(fullNewMzDepositFiles,newMzDepositFiles,m,djzAmount,Constants.DJZ);
|
|
|
+ }else {
|
|
|
+ addNewDepositFile(fullNewMzDepositFiles,newMzDepositFiles,m,djzAmount.add(tempTotalFee),Constants.DJZ);
|
|
|
+ removeByChequeType(refundMzDepositFiles,Constants.DJZ);
|
|
|
+ setRefundData(refundMzDepositFiles, m, Constants.DJZ, djzAmount.add(tempTotalFee));
|
|
|
+ }
|
|
|
}
|
|
|
//优惠活动
|
|
|
- if(yhhdAmount.compareTo(BigDecimal.ZERO) == 1){
|
|
|
- addNewDepositFile(fullNewMzDepositFiles,newMzDepositFiles,m,yhhdAmount,Constants.YH_HD);
|
|
|
+ if(yhhdAmount.compareTo(BigDecimal.ZERO) == 1 && tempTotalFee.compareTo(BigDecimal.ZERO) > 0){
|
|
|
tempTotalFee = tempTotalFee.subtract(yhhdAmount);
|
|
|
+ if(tempTotalFee.compareTo(BigDecimal.ZERO) >=0){
|
|
|
+ addNewDepositFile(fullNewMzDepositFiles,newMzDepositFiles,m,yhhdAmount,Constants.YH_HD);
|
|
|
+ }else {
|
|
|
+ addNewDepositFile(fullNewMzDepositFiles,newMzDepositFiles,m,yhhdAmount.add(tempTotalFee),Constants.YH_HD);
|
|
|
+ removeByChequeType(refundMzDepositFiles,Constants.YH_HD);
|
|
|
+ setRefundData(refundMzDepositFiles, m, Constants.YH_HD, yhhdAmount.add(tempTotalFee));
|
|
|
+ }
|
|
|
}
|
|
|
//GCP
|
|
|
- if(gcpAmount.compareTo(BigDecimal.ZERO) == 1){
|
|
|
- addNewDepositFile(fullNewMzDepositFiles,newMzDepositFiles,m,gcpAmount,Constants.GCP);
|
|
|
+ if(gcpAmount.compareTo(BigDecimal.ZERO) == 1 && tempTotalFee.compareTo(BigDecimal.ZERO) > 0){
|
|
|
tempTotalFee = tempTotalFee.subtract(gcpAmount);
|
|
|
+ if(tempTotalFee.compareTo(BigDecimal.ZERO) >=0){
|
|
|
+ addNewDepositFile(fullNewMzDepositFiles,newMzDepositFiles,m,gcpAmount,Constants.GCP);
|
|
|
+ }else {
|
|
|
+ addNewDepositFile(fullNewMzDepositFiles,newMzDepositFiles,m,gcpAmount.add(tempTotalFee),Constants.GCP);
|
|
|
+ removeByChequeType(refundMzDepositFiles,Constants.GCP);
|
|
|
+ setRefundData(refundMzDepositFiles, m, Constants.GCP, gcpAmount.add(tempTotalFee));
|
|
|
+ }
|
|
|
}
|
|
|
//部分退费添加医保报销收费方式
|
|
|
- if(ybFlag){
|
|
|
+ if(ybFlag && tempTotalFee.compareTo(BigDecimal.ZERO) > 0){
|
|
|
List<MzDepositFile> ybMzDepositFile = getMzChargeDetailService().getYbMzDepositFile(m,mzDepositFileVo);
|
|
|
if(CollUtil.isNotEmpty(ybMzDepositFile)){
|
|
|
//删除退费显示现金的
|
|
@@ -4860,10 +4872,14 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
}
|
|
|
}
|
|
|
}else {
|
|
|
- dealDesPosFile(opId, now, times, serialNo, tempTotalFee, fullNewMzDepositFiles, newMzDepositFiles, byjzAmount, notByjzAmount, posAmount, needRefundList, relationMap, refundMzDepositFiles, m);
|
|
|
+ if(tempTotalFee.compareTo(BigDecimal.ZERO) > 0){
|
|
|
+ dealDesPosFile(opId, now, times, serialNo, tempTotalFee, fullNewMzDepositFiles, newMzDepositFiles, byjzAmount, notByjzAmount, posAmount, needRefundList, relationMap, refundMzDepositFiles, m);
|
|
|
+ }
|
|
|
}
|
|
|
}else {
|
|
|
- dealDesPosFile(opId, now, times, serialNo, tempTotalFee, fullNewMzDepositFiles, newMzDepositFiles, byjzAmount, notByjzAmount, posAmount, needRefundList, relationMap, refundMzDepositFiles, m);
|
|
|
+ if(tempTotalFee.compareTo(BigDecimal.ZERO) > 0){
|
|
|
+ dealDesPosFile(opId, now, times, serialNo, tempTotalFee, fullNewMzDepositFiles, newMzDepositFiles, byjzAmount, notByjzAmount, posAmount, needRefundList, relationMap, refundMzDepositFiles, m);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
log.info("pos应退的费用明细:{}",JsonUtil.object2Json(needRefundList));
|
|
@@ -5740,6 +5756,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
newList.add(newMzReceiptSerial);
|
|
|
} else {
|
|
|
MzReceiptSerial tempMzReceiptSerial = CloneUtil.clone(newMzReceiptSerial);
|
|
|
+ tempMzReceiptSerial.resetParams();
|
|
|
tempMzReceiptSerial.setChequeType(mzDepositFile.getChequeType());
|
|
|
tempMzReceiptSerial.setTotalCharge(mzDepositFile.getAmount());
|
|
|
newList.add(tempMzReceiptSerial);
|
|
@@ -5817,15 +5834,32 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
newMzDepositFile.setChargeDate(now);
|
|
|
newMzDepositFile.setSerialNo(serialNo);
|
|
|
newMzDepositFile.setReceiptSn(serialNo);
|
|
|
- newMzDepositFile.setChequeType(pMzDepositFile.getChequeType());
|
|
|
- newMzDepositFile.setContractId(pMzDepositFile.getContractId());
|
|
|
- newMzDepositFile.setPsordnum(pMzDepositFile.getPsordnum());
|
|
|
- newMzDepositFile.setAgtordnum(pMzDepositFile.getAgtordnum());
|
|
|
- newMzDepositFile.setParChannel(pMzDepositFile.getParChannel());
|
|
|
- newMzDepositFile.setTransDate(pMzDepositFile.getTransDate());
|
|
|
- newMzDepositFile.setTraceNo(pMzDepositFile.getTraceNo());
|
|
|
newMzDepositFile.setOpId(opId);
|
|
|
- newList.add(newMzDepositFile);
|
|
|
+ for (int i = 0; i < mzDepositFileVo.getMzDepositFiles().size(); i++) {
|
|
|
+ MzDepositFile mzDepositFile = mzDepositFileVo.getMzDepositFiles().get(i);
|
|
|
+ if(i == 0){
|
|
|
+ newMzDepositFile.setAmount(mzDepositFile.getAmount());
|
|
|
+ newMzDepositFile.setChequeType(mzDepositFile.getChequeType());
|
|
|
+ newMzDepositFile.setContractId(mzDepositFile.getContractId());
|
|
|
+ newMzDepositFile.setPsordnum(mzDepositFile.getPsordnum());
|
|
|
+ newMzDepositFile.setAgtordnum(mzDepositFile.getAgtordnum());
|
|
|
+ newMzDepositFile.setParChannel(mzDepositFile.getParChannel());
|
|
|
+ newMzDepositFile.setTransDate(mzDepositFile.getTransDate());
|
|
|
+ newMzDepositFile.setTraceNo(mzDepositFile.getTraceNo());
|
|
|
+ newList.add(newMzDepositFile);
|
|
|
+ }else {
|
|
|
+ MzDepositFile tempMzDepositFile = CloneUtil.clone(newMzDepositFile);
|
|
|
+ tempMzDepositFile.setAmount(mzDepositFile.getAmount());
|
|
|
+ tempMzDepositFile.setChequeType(mzDepositFile.getChequeType());
|
|
|
+ tempMzDepositFile.setContractId(mzDepositFile.getContractId());
|
|
|
+ tempMzDepositFile.setPsordnum(mzDepositFile.getPsordnum());
|
|
|
+ tempMzDepositFile.setAgtordnum(mzDepositFile.getAgtordnum());
|
|
|
+ tempMzDepositFile.setParChannel(mzDepositFile.getParChannel());
|
|
|
+ tempMzDepositFile.setTransDate(mzDepositFile.getTransDate());
|
|
|
+ tempMzDepositFile.setTraceNo(mzDepositFile.getTraceNo());
|
|
|
+ newList.add(tempMzDepositFile);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
j.setReceiptNo(0 - j.getReceiptNo());
|
|
|
j.setAmount(BigDecimal.ZERO.subtract(j.getAmount()));
|