|
|
@@ -129,10 +129,10 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
@Override
|
|
|
public int countMzChargeDetail(MzChargeDetailPageDto mzChargeDetailPageDto) {
|
|
|
mzChargeDetailPageDto.setTableName("mz_charge_detail");
|
|
|
- Integer num= mzChargeDetailMapper.countMzChargeDetail(mzChargeDetailPageDto);
|
|
|
- if(num==null || num==0){
|
|
|
+ Integer num = mzChargeDetailMapper.countMzChargeDetail(mzChargeDetailPageDto);
|
|
|
+ if (num == null || num == 0) {
|
|
|
mzChargeDetailPageDto.setTableName("mz_charge_detail_b");
|
|
|
- num= mzChargeDetailMapper.countMzChargeDetail(mzChargeDetailPageDto);
|
|
|
+ num = mzChargeDetailMapper.countMzChargeDetail(mzChargeDetailPageDto);
|
|
|
}
|
|
|
return num;
|
|
|
}
|
|
|
@@ -140,23 +140,23 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
@Override
|
|
|
public List<MzChargeDetail> queryMzChargeDetailWithPage(MzChargeDetailPageDto mzChargeDetailPageDto) {
|
|
|
mzChargeDetailPageDto.setTableName("mz_charge_detail");
|
|
|
- String receiptSerialTableName="mz_receipt_serial";
|
|
|
+ String receiptSerialTableName = "mz_receipt_serial";
|
|
|
List<MzChargeDetail> mzChargeDetailList = mzChargeDetailMapper.selectMzChargeDetailWithPage(mzChargeDetailPageDto);
|
|
|
if (mzChargeDetailList == null || mzChargeDetailList.size() == 0) {
|
|
|
mzChargeDetailPageDto.setTableName("mz_charge_detail_b");
|
|
|
- receiptSerialTableName="mz_receipt_serial_b";
|
|
|
+ receiptSerialTableName = "mz_receipt_serial_b";
|
|
|
mzChargeDetailList = mzChargeDetailMapper.selectMzChargeDetailWithPage(mzChargeDetailPageDto);
|
|
|
if (mzChargeDetailList == null || mzChargeDetailList.size() == 0) {
|
|
|
return mzChargeDetailList;
|
|
|
}
|
|
|
}
|
|
|
for (MzChargeDetail mzChargeDetail : mzChargeDetailList) {
|
|
|
- MzChargeDetail temp = mzChargeDetailMapper.selectWarnDeptAndDoctor(mzChargeDetail.getPatientId(), mzChargeDetail.getTimes(),mzChargeDetailPageDto.getTableName());
|
|
|
+ MzChargeDetail temp = mzChargeDetailMapper.selectWarnDeptAndDoctor(mzChargeDetail.getPatientId(), mzChargeDetail.getTimes(), mzChargeDetailPageDto.getTableName());
|
|
|
mzChargeDetail.setWarnDept(temp.getWarnDept());
|
|
|
mzChargeDetail.setDoctorCode(temp.getDoctorCode());
|
|
|
mzChargeDetail.setPrintFlag(temp.getPrintFlag());
|
|
|
if (PayMarkEnum.CHARGED.code.equals(mzChargeDetailPageDto.getMzChargeDetail().getPayMark())) {
|
|
|
- List<MzReceiptSerial> mzReceiptSerials = mzReceiptSerialMapper.selectReceiptDetails(mzChargeDetail.getPatientId(), mzChargeDetail.getTimes(), mzChargeDetail.getReceiptNo(),receiptSerialTableName);
|
|
|
+ List<MzReceiptSerial> mzReceiptSerials = mzReceiptSerialMapper.selectReceiptDetails(mzChargeDetail.getPatientId(), mzChargeDetail.getTimes(), mzChargeDetail.getReceiptNo(), receiptSerialTableName);
|
|
|
if (mzReceiptSerials != null && mzReceiptSerials.size() > 0) {
|
|
|
MzReceiptSerial mzReceiptSerial = mzReceiptSerials.get(0);
|
|
|
//此时发票号为空,判断收费类型,如果是Y,(说明是本院记账或者单病种缴费),不允许打印发票 如果其他类型,说明非本院记账,可以打印 故设置打印标记为未打印
|
|
|
@@ -222,7 +222,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
*/
|
|
|
@Override
|
|
|
public MzChargeDetail unPaidToFullChargeDetail(MzChargeDetail mzChargeDetail) throws MzException {
|
|
|
- MzVisitTable mzVisitTable = mzVisitTableMapper.selectByPatientIdAndTimes(mzChargeDetail.getPatientId(), mzChargeDetail.getTimes(),"mz_visit_table");
|
|
|
+ MzVisitTable mzVisitTable = mzVisitTableMapper.selectByPatientIdAndTimes(mzChargeDetail.getPatientId(), mzChargeDetail.getTimes(), "mz_visit_table");
|
|
|
if (mzVisitTable == null) {
|
|
|
throw new MzException("当前病人就诊基础资料【MzVisitTable】不存在,请检查");
|
|
|
}
|
|
|
@@ -259,7 +259,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
md.setUnitPrice(unitPrice);
|
|
|
}
|
|
|
returnMzChargeDetail.setAmount(returnMzChargeDetail.getAmount().add(unitPrice.multiply(BigDecimal.valueOf(md.getQuantity() == null ? 1D : md.getQuantity())).multiply(BigDecimal.valueOf(md.getDrugWin() == null ? 1D : md.getDrugWin()))));
|
|
|
- returnMzChargeDetail.setNotDiscountAmount(returnMzChargeDetail.getNotDiscountAmount().add((md.getOrigPrice()==null?BigDecimal.ZERO:md.getOrigPrice()).multiply(BigDecimal.valueOf(md.getQuantity() == null ? 1D : md.getQuantity())).multiply(BigDecimal.valueOf(md.getDrugWin() == null ? 1D : md.getDrugWin()))));
|
|
|
+ returnMzChargeDetail.setNotDiscountAmount(returnMzChargeDetail.getNotDiscountAmount().add((md.getOrigPrice() == null ? BigDecimal.ZERO : md.getOrigPrice()).multiply(BigDecimal.valueOf(md.getQuantity() == null ? 1D : md.getQuantity())).multiply(BigDecimal.valueOf(md.getDrugWin() == null ? 1D : md.getDrugWin()))));
|
|
|
}
|
|
|
returnMzChargeDetail.setDiscountAmount(returnMzChargeDetail.getNotDiscountAmount().subtract(returnMzChargeDetail.getAmount()).setScale(1, BigDecimal.ROUND_HALF_UP));
|
|
|
return returnMzChargeDetail;
|
|
|
@@ -335,7 +335,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
}
|
|
|
}
|
|
|
//预览的时候获取费用明细,需要打折,不是预览而是入库的时候不打折,因为入库后会有一次重新计算
|
|
|
- formatPriceRoundDetail(mzChargeDetail, mzChargeDetails, mzPatientMi, mzChargeDetailList, maxOrderNo, itemNo, receiptNo,YesNoEnum.YES.equals(yesNo)?true:false);
|
|
|
+ formatPriceRoundDetail(mzChargeDetail, mzChargeDetails, mzPatientMi, mzChargeDetailList, maxOrderNo, itemNo, receiptNo, YesNoEnum.YES.equals(yesNo) ? true : false);
|
|
|
//yes 预览需要将原数据库中已存在的明细与临时生成的一起返回
|
|
|
if (YesNoEnum.YES.equals(yesNo)) {
|
|
|
for (MzChargeDetail mcd : mzChargeDetailList) {
|
|
|
@@ -380,7 +380,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public List<MzChargeDetail> unPaidToFullChargeDetail(String patientId,String name) throws MzException {
|
|
|
+ public List<MzChargeDetail> unPaidToFullChargeDetail(String patientId, String name) throws MzException {
|
|
|
if (StringUtils.isBlank(patientId)) {
|
|
|
throw new MzException("病人编号不能为空!");
|
|
|
}
|
|
|
@@ -406,7 +406,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
} catch (ClassCastException e) {
|
|
|
mzChargeDetail.setTimes(Integer.valueOf((Short) map.get("times")));
|
|
|
}
|
|
|
- MzChargeDetail mzChargeDetail1=unPaidToFullChargeDetail(mzChargeDetail);
|
|
|
+ MzChargeDetail mzChargeDetail1 = unPaidToFullChargeDetail(mzChargeDetail);
|
|
|
mzChargeDetail1.setName(name);
|
|
|
returnMzChargeDetails.add(mzChargeDetail1);
|
|
|
}
|
|
|
@@ -422,11 +422,11 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
@Override
|
|
|
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, timeout = 36000, rollbackFor = Exception.class)
|
|
|
public int chargeFee(String opId, MzDepositFileVo mzDepositFileVo) throws MzException {
|
|
|
- Windows windows = windowsMapper.selectLastWindowsByUserIdCode(opId,null);
|
|
|
+ Windows windows = windowsMapper.selectLastWindowsByUserIdCode(opId, null);
|
|
|
if (windows == null) {
|
|
|
throw new MzException("当前操作人未设置窗口号,请先设置!");
|
|
|
}
|
|
|
- MzVisitTable mzVisitTable = mzVisitTableMapper.selectByPatientIdAndTimes(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes(),"mz_visit_table");
|
|
|
+ MzVisitTable mzVisitTable = mzVisitTableMapper.selectByPatientIdAndTimes(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes(), "mz_visit_table");
|
|
|
if (mzVisitTable == null) {
|
|
|
throw new MzException("当前病人就诊基础资料【MzVisitTable】不存在,请检查");
|
|
|
}
|
|
|
@@ -446,7 +446,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
//所有应收费用的明细 将所有费用按照类型归类
|
|
|
Map<String, BigDecimal> feeMap = new HashMap<>();
|
|
|
//实际应付金额
|
|
|
- BigDecimal totalPayable = getTotalPayable(mzChargeDetailList, feeMap,true);
|
|
|
+ BigDecimal totalPayable = getTotalPayable(mzChargeDetailList, feeMap, true);
|
|
|
//实际应付金额 四舍五入后的值 收费员收的钱小数点后只有一位有效值
|
|
|
BigDecimal totalPayableRound = totalPayable.setScale(1, BigDecimal.ROUND_HALF_UP);
|
|
|
//单病种收费不设置金额,所以自动设置金额
|
|
|
@@ -469,7 +469,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
}
|
|
|
//本院记账,设置收款方式
|
|
|
if (receiptSerialFee.getByjzje() != null && receiptSerialFee.getByjzje().compareTo(BigDecimal.ZERO) == 1) {
|
|
|
- mzChargeDetailMapper.updateChequeTypeByserialNo(Constants.BYJZ,serialNo);
|
|
|
+ mzChargeDetailMapper.updateChequeTypeByserialNo(Constants.BYJZ, serialNo);
|
|
|
}
|
|
|
//发送缴费成功MQ
|
|
|
orderStatusChangeService.orderStatusChange(mzDepositFileVo.getPatientId() + "_" + mzDepositFileVo.getTimes() + "_" + receiptNo + "," + OrderStatusEnum.SUCCESSFUL_PRESCRIPTION_PAYMENT.code);
|
|
|
@@ -507,7 +507,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
if (receiptSerialFee.getByjzje() != null && receiptSerialFee.getByjzje().compareTo(BigDecimal.ZERO) == 1) {
|
|
|
MzReceiptSerial jzMzReceiptSerial = CloneUtil.clone(mzReceiptSerial);
|
|
|
//当前付款方式有除本院记账以外的,需要清空发票表的明细数据
|
|
|
- if(receiptSerialFee.getZfTotalPayable().compareTo(BigDecimal.ZERO)==1 || receiptSerialFee.getYbjzje().compareTo(BigDecimal.ZERO)==1){
|
|
|
+ if (receiptSerialFee.getZfTotalPayable().compareTo(BigDecimal.ZERO) == 1 || receiptSerialFee.getYbjzje().compareTo(BigDecimal.ZERO) == 1) {
|
|
|
resetParams(jzMzReceiptSerial);
|
|
|
}
|
|
|
jzMzReceiptSerial.setTotalCharge(receiptSerialFee.getByjzje());
|
|
|
@@ -567,7 +567,7 @@ 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){
|
|
|
+ if (mzChargeDetailList == null || mzChargeDetailList.size() == 0) {
|
|
|
mzChargeDetailMapper.reInsertDetail(mzChargeDetail);
|
|
|
mzChargeDetailMapper.deleteFromBak(mzChargeDetail);
|
|
|
mzChargeDetail.setChequType(Constants.BYJZ);
|
|
|
@@ -680,7 +680,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
}
|
|
|
if (mzChargeDetail.getAmount() != null) {
|
|
|
mzChargeDetail.setAmount(mzChargeDetail.getAmount().setScale(1, BigDecimal.ROUND_HALF_UP));
|
|
|
- if(mzChargeDetail.getNotDiscountAmount()!=null){
|
|
|
+ if (mzChargeDetail.getNotDiscountAmount() != null) {
|
|
|
mzChargeDetail.setNotDiscountAmount(mzChargeDetail.getNotDiscountAmount().setScale(1, BigDecimal.ROUND_HALF_UP));
|
|
|
mzChargeDetail.setDiscountAmount(mzChargeDetail.getNotDiscountAmount().subtract(mzChargeDetail.getAmount()).setScale(1, BigDecimal.ROUND_HALF_UP));
|
|
|
}
|
|
|
@@ -930,16 +930,16 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
@Override
|
|
|
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, timeout = 36000, rollbackFor = Exception.class)
|
|
|
public int modifyChequType(String chequeType, Integer receiptSn, String oldChequeType) throws MzException {
|
|
|
- List<MzDepositFile> mzDepositFiles= mzDepositFileMapper.selectMzDepositFileBySerialNo(receiptSn,oldChequeType);
|
|
|
- if(mzDepositFiles==null || mzDepositFiles.size()==0){
|
|
|
+ List<MzDepositFile> mzDepositFiles = mzDepositFileMapper.selectMzDepositFileBySerialNo(receiptSn, oldChequeType);
|
|
|
+ if (mzDepositFiles == null || mzDepositFiles.size() == 0) {
|
|
|
throw new MzException("当前病人不存在收费信息!");
|
|
|
}
|
|
|
- List<MzDepositFile> mzDepositFileList= mzDepositFileMapper.selectMzDepositFileBySerialNo(receiptSn,chequeType);
|
|
|
- if(mzDepositFileList!=null && mzDepositFileList.size()>0){
|
|
|
+ List<MzDepositFile> mzDepositFileList = mzDepositFileMapper.selectMzDepositFileBySerialNo(receiptSn, chequeType);
|
|
|
+ if (mzDepositFileList != null && mzDepositFileList.size() > 0) {
|
|
|
throw new MzException("当前病人已经存在以新修改的收款方式收款的收费记录,请查证是否操作有误!");
|
|
|
}
|
|
|
MzDepositFile mzDepositFile = mzDepositFiles.get(0);
|
|
|
- mzDepositFileMapper.updateChequeType(chequeType,receiptSn,oldChequeType);
|
|
|
+ mzDepositFileMapper.updateChequeType(chequeType, receiptSn, oldChequeType);
|
|
|
MzReceiptSerial mzReceiptSerial = new MzReceiptSerial();
|
|
|
mzReceiptSerial.setPatientId(mzDepositFile.getPatientId());
|
|
|
mzReceiptSerial.setTimes(mzDepositFile.getTimes());
|
|
|
@@ -948,19 +948,19 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
mzReceiptSerial.setNewChequeType(chequeType);
|
|
|
mzReceiptSerialMapper.updateMzReceiptSerialByReceiptNo(mzReceiptSerial);
|
|
|
//新的收款方式是记账,设置成记账方式
|
|
|
- if(Constants.BYJZ.equals(chequeType)){
|
|
|
- MzChargeDetail mzChargeDetail = new MzChargeDetail(mzDepositFile.getPatientId(),mzDepositFile.getTimes());
|
|
|
+ if (Constants.BYJZ.equals(chequeType)) {
|
|
|
+ MzChargeDetail mzChargeDetail = new MzChargeDetail(mzDepositFile.getPatientId(), mzDepositFile.getTimes());
|
|
|
mzChargeDetail.setReceiptNo(mzDepositFile.getReceiptNo());
|
|
|
mzChargeDetail.setChequType(chequeType);
|
|
|
mzChargeDetailMapper.updateMzChargeDetailFull(mzChargeDetail);
|
|
|
}
|
|
|
//老的收费方式是记账,设置成空白
|
|
|
- if(Constants.BYJZ.equals(oldChequeType)){
|
|
|
- MzChargeDetail mzChargeDetail = new MzChargeDetail(mzDepositFile.getPatientId(),mzDepositFile.getTimes());
|
|
|
- mzChargeDetail.setReceiptNo(mzDepositFile.getReceiptNo());
|
|
|
- mzChargeDetail.setChequType("");
|
|
|
- mzChargeDetailMapper.updateMzChargeDetailFull(mzChargeDetail);
|
|
|
- }
|
|
|
+ if (Constants.BYJZ.equals(oldChequeType)) {
|
|
|
+ MzChargeDetail mzChargeDetail = new MzChargeDetail(mzDepositFile.getPatientId(), mzDepositFile.getTimes());
|
|
|
+ mzChargeDetail.setReceiptNo(mzDepositFile.getReceiptNo());
|
|
|
+ mzChargeDetail.setChequType("");
|
|
|
+ mzChargeDetailMapper.updateMzChargeDetailFull(mzChargeDetail);
|
|
|
+ }
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
@@ -991,7 +991,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, timeout = 36000, rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
public void updateChargeFlag(String opId, String patientId, Integer times, String name, List<MzChargeDetail> mzChargeDetailList, Date now, int serialNo, String chequeType, Integer refundTimes) throws MzException {
|
|
|
- if(mzChargeDetailList==null || mzChargeDetailList.size() == 0){
|
|
|
+ if (mzChargeDetailList == null || mzChargeDetailList.size() == 0) {
|
|
|
return;
|
|
|
}
|
|
|
//更新费用明细表的收费状态和发票与收费流水号
|
|
|
@@ -1027,7 +1027,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
//退费 此时药房还没有发药 直接修改发药队列数据
|
|
|
List<MzYpFydl> mzYpFydls = mzYpFydlMapper.selectMzYpFydl(patientId, refundTimes);
|
|
|
if (mzYpFydls != null && mzYpFydls.size() > 0) {
|
|
|
- mzYpFydlMapper.deleteMzYpFydl(patientId, refundTimes,null);
|
|
|
+ mzYpFydlMapper.deleteMzYpFydl(patientId, refundTimes, null);
|
|
|
Set<String> keySet = orderNoMap.keySet();
|
|
|
for (MzYpFydl mzYpFydl : mzYpFydls) {
|
|
|
//如果新的组队列中不包含当前的发药队列,说明该药品全退了
|
|
|
@@ -1123,7 +1123,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
|
|
|
@Override
|
|
|
public List<MzChargeDetail> getTempMzChargeDetailListForUnPaid(MzChargeDetail mzChargeDetail) throws MzException {
|
|
|
- MzVisitTable mzVisitTable = mzVisitTableMapper.selectByPatientIdAndTimes(mzChargeDetail.getPatientId(), mzChargeDetail.getTimes(),"mz_visit_table");
|
|
|
+ MzVisitTable mzVisitTable = mzVisitTableMapper.selectByPatientIdAndTimes(mzChargeDetail.getPatientId(), mzChargeDetail.getTimes(), "mz_visit_table");
|
|
|
if (mzVisitTable == null) {
|
|
|
throw new MzException("当前病人就诊基础资料【MzVisitTable】不存在,请检查");
|
|
|
}
|
|
|
@@ -1139,7 +1139,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
@Override
|
|
|
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, timeout = 36000, rollbackFor = Exception.class)
|
|
|
public int refundFee(String opId, MzDepositFileVo mzDepositFileVo) throws MzException {
|
|
|
- Windows windows = windowsMapper.selectLastWindowsByUserIdCode(opId,null);
|
|
|
+ Windows windows = windowsMapper.selectLastWindowsByUserIdCode(opId, null);
|
|
|
if (windows == null) {
|
|
|
throw new MzException("当前操作人未设置窗口号,请先设置!");
|
|
|
}
|
|
|
@@ -1232,7 +1232,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
//所有应收费用的明细 将所有费用按照类型归类
|
|
|
Map<String, BigDecimal> feeMap = new HashMap<>();
|
|
|
//实际应付金额
|
|
|
- BigDecimal totalPayable = getTotalPayable(mzChargeDetails, feeMap,false);
|
|
|
+ BigDecimal totalPayable = getTotalPayable(mzChargeDetails, feeMap, false);
|
|
|
MzReceiptSerial mzReceiptSerial = new MzReceiptSerial();
|
|
|
ReceiptSerialFee receiptSerialFee = new ReceiptSerialFee();
|
|
|
//退费后新的收款方式
|
|
|
@@ -1242,7 +1242,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
//setMzReceiptSerial(opId, mzDepositFileVo.getPatientId(), times, windows, mzChargeDetails.get(0).getResponceType(), feeMap, now, serialNo, mzReceiptSerial, payWay, totalPayable, 1);
|
|
|
MzPatientMi mzPatientMi = mzPatientMiService.queryByPatientId(mzDepositFileVo.getPatientId());
|
|
|
mzDepositFileVo.setMzDepositFiles(newMzDepositFiles);
|
|
|
- Integer refundTimes =mzDepositFileVo.getTimes();
|
|
|
+ Integer refundTimes = mzDepositFileVo.getTimes();
|
|
|
mzDepositFileVo.setTimes(times);
|
|
|
getHadPayable(opId, mzDepositFileVo, windows, mzPatientMi, feeMap, now, serialNo, mzReceiptSerial, 1, receiptSerialFee);
|
|
|
getMzChargeDetailService().updateChargeFlag(opId, mzDepositFileVo.getPatientId(), times, mzChargeDetails.get(0).getName(), mzChargeDetails, now, serialNo, payWay, refundTimes);
|
|
|
@@ -1303,7 +1303,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
mz.setCharge20(BigDecimal.ZERO.subtract(mz.getCharge20()));
|
|
|
if (Constants.BYJZ.equals(mz.getChequeType())) {
|
|
|
mz.setChequeType(Constants.BYJZ);
|
|
|
- }else if (Constants.YBJZ.equals(mz.getChequeType())) {
|
|
|
+ } else if (Constants.YBJZ.equals(mz.getChequeType())) {
|
|
|
mz.setChequeType(Constants.YBJZ);
|
|
|
} else {
|
|
|
mz.setChequeType(Constants.CASH);
|
|
|
@@ -1367,84 +1367,92 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
* @return
|
|
|
*/
|
|
|
private String getDeposFiles(String opId, MzDepositFileVo mzDepositFileVo, Date now, int times, int serialNo, BigDecimal totalPayable, String payWay, List<MzDepositFile> fullNewMzDepositFiles, boolean allRefund, List<MzDepositFile> newMzDepositFiles) {
|
|
|
- List<MzDepositFile> mzDepositFiles = mzDepositFileMapper.selectMzDepositFileByTimes(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes(), mzDepositFileVo.getReceiptNo(),"mz_deposit_file");
|
|
|
- if (mzDepositFiles != null || mzDepositFiles.size() > 0) {
|
|
|
- //本院记账总额
|
|
|
- BigDecimal byjzAmount = BigDecimal.ZERO;
|
|
|
- //非本院记账总额
|
|
|
- BigDecimal notByjzAmount = BigDecimal.ZERO;
|
|
|
- MzDepositFile temp = CloneUtil.clone(mzDepositFiles.get(0));
|
|
|
- temp.setReceiptNo(-temp.getReceiptNo());
|
|
|
- temp.setAmount(BigDecimal.ZERO.subtract(temp.getAmount()));
|
|
|
- temp.setReceiptSn(-temp.getReceiptSn());
|
|
|
- temp.setSerialNo(-temp.getSerialNo());
|
|
|
- temp.setDeptNo(null);
|
|
|
- temp.setChargeDate(now);
|
|
|
- temp.setPayMark(PayMarkEnum.RETURN_PREMIUM.code);
|
|
|
- temp.setOpId(opId);
|
|
|
- temp.setChequeType(Constants.CASH);
|
|
|
- temp.setDcountNo(YesNoEnum.NO.code);
|
|
|
- temp.setDcountDate(null);
|
|
|
- temp.setPsordnum(null);
|
|
|
- temp.setAgtordnum(null);
|
|
|
- temp.setHisrefundnum(null);
|
|
|
- for (MzDepositFile ms : mzDepositFiles) {
|
|
|
- if (ms != null) {
|
|
|
- if (Constants.BYJZ.equals(ms.getChequeType())) {
|
|
|
- byjzAmount = byjzAmount.add(ms.getAmount());
|
|
|
- } else {
|
|
|
- notByjzAmount = notByjzAmount.add(ms.getAmount());
|
|
|
- }
|
|
|
- }
|
|
|
+ List<MzDepositFile> mzDepositFiles = mzDepositFileMapper.selectMzDepositFileByTimes(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes(), mzDepositFileVo.getReceiptNo(), "mz_deposit_file");
|
|
|
+ if (mzDepositFiles == null || mzDepositFiles.size() == 0) {
|
|
|
+ return payWay;
|
|
|
+ }
|
|
|
+ //本院记账总额
|
|
|
+ BigDecimal byjzAmount = BigDecimal.ZERO;
|
|
|
+ //非本院记账总额
|
|
|
+ BigDecimal notByjzAmount = BigDecimal.ZERO;
|
|
|
+ MzDepositFile temp = CloneUtil.clone(mzDepositFiles.get(0));
|
|
|
+ temp.setReceiptNo(-temp.getReceiptNo());
|
|
|
+ temp.setAmount(BigDecimal.ZERO.subtract(temp.getAmount()));
|
|
|
+ temp.setReceiptSn(-temp.getReceiptSn());
|
|
|
+ temp.setSerialNo(-temp.getSerialNo());
|
|
|
+ temp.setDeptNo(null);
|
|
|
+ temp.setChargeDate(now);
|
|
|
+ temp.setPayMark(PayMarkEnum.RETURN_PREMIUM.code);
|
|
|
+ temp.setOpId(opId);
|
|
|
+ //当前退费发起人是手机自助,且退费的记录的缴费人也是手机自助发起的缴费记录退费方式
|
|
|
+ if(Constants.BRZZJF_CODE.equals(opId) && Constants.BRZZJF_CODE.equals(temp.getOpId())){
|
|
|
+ payWay=temp.getChequeType();
|
|
|
+ }else {
|
|
|
+ payWay=Constants.CASH;
|
|
|
+ temp.setChequeType(payWay);
|
|
|
+ }
|
|
|
+ temp.setDcountNo(YesNoEnum.NO.code);
|
|
|
+ temp.setDcountDate(null);
|
|
|
+ temp.setPsordnum(null);
|
|
|
+ temp.setAgtordnum(null);
|
|
|
+ temp.setHisrefundnum(null);
|
|
|
+ for (MzDepositFile ms : mzDepositFiles) {
|
|
|
+ if (ms == null) {
|
|
|
+ continue;
|
|
|
}
|
|
|
- temp.setAmount(BigDecimal.ZERO.subtract(notByjzAmount));
|
|
|
- //复制一个本院记账的退款记录
|
|
|
- MzDepositFile byjzTemp = CloneUtil.clone(temp);
|
|
|
- byjzTemp.setChequeType(Constants.BYJZ);
|
|
|
- byjzTemp.setAmount(BigDecimal.ZERO.subtract(byjzAmount));
|
|
|
- //如果有本院记账的退款金额,本院记账记录保持入库
|
|
|
- if (byjzAmount.compareTo(BigDecimal.ZERO) == 1) {
|
|
|
- fullNewMzDepositFiles.add(byjzTemp);
|
|
|
- }
|
|
|
- //如果有非本院记账的退款金额,非本院记账记录保持入库
|
|
|
- if (notByjzAmount.compareTo(BigDecimal.ZERO) == 1) {
|
|
|
- fullNewMzDepositFiles.add(temp);
|
|
|
- }
|
|
|
- if (!allRefund) {
|
|
|
- MzDepositFile m = mzDepositFiles.get(0);
|
|
|
- m.setTimes(times);
|
|
|
- m.setReceiptNo(1);
|
|
|
- m.setPayMark(PayMarkEnum.CHARGED.code);
|
|
|
- m.setChargeDate(now);
|
|
|
- m.setDcountNo(YesNoEnum.NO.code);
|
|
|
- m.setDcountDate(null);
|
|
|
- m.setOpId(opId);
|
|
|
- m.setReceiptSn(serialNo);
|
|
|
- m.setSerialNo(serialNo);
|
|
|
- m.setPsordnum(null);
|
|
|
- m.setAgtordnum(null);
|
|
|
- m.setHisrefundnum(null);
|
|
|
- //应付小于等于实际已经支付的非记账总额
|
|
|
- if (totalPayable.compareTo(notByjzAmount) <= 0) {
|
|
|
- m.setAmount(totalPayable);
|
|
|
- m.setChequeType(Constants.CASH);
|
|
|
- fullNewMzDepositFiles.add(m);
|
|
|
- //应付大于实际已经支付的非记账总额,需要用记账收一部分
|
|
|
- payWay = Constants.CASH;
|
|
|
- newMzDepositFiles.add(m);
|
|
|
- } else if (totalPayable.compareTo(notByjzAmount) == 1) {
|
|
|
- m.setAmount(notByjzAmount);
|
|
|
- m.setChequeType(Constants.CASH);
|
|
|
- fullNewMzDepositFiles.add(m);
|
|
|
- //复制一个本院记账的收款记录
|
|
|
- MzDepositFile byjzNeedPayTemp = CloneUtil.clone(m);
|
|
|
- byjzNeedPayTemp.setChequeType(Constants.BYJZ);
|
|
|
- byjzNeedPayTemp.setAmount(totalPayable.subtract(notByjzAmount).setScale(1, BigDecimal.ROUND_HALF_UP));
|
|
|
- fullNewMzDepositFiles.add(byjzNeedPayTemp);
|
|
|
- newMzDepositFiles.add(m);
|
|
|
- newMzDepositFiles.add(byjzNeedPayTemp);
|
|
|
- payWay = Constants.BYJZ;
|
|
|
- }
|
|
|
+ if (Constants.BYJZ.equals(ms.getChequeType())) {
|
|
|
+ byjzAmount = byjzAmount.add(ms.getAmount());
|
|
|
+ } else {
|
|
|
+ notByjzAmount = notByjzAmount.add(ms.getAmount());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ temp.setAmount(BigDecimal.ZERO.subtract(notByjzAmount));
|
|
|
+ //复制一个本院记账的退款记录
|
|
|
+ MzDepositFile byjzTemp = CloneUtil.clone(temp);
|
|
|
+ byjzTemp.setChequeType(Constants.BYJZ);
|
|
|
+ byjzTemp.setAmount(BigDecimal.ZERO.subtract(byjzAmount));
|
|
|
+ //如果有本院记账的退款金额,本院记账记录保持入库
|
|
|
+ if (byjzAmount.compareTo(BigDecimal.ZERO) == 1) {
|
|
|
+ fullNewMzDepositFiles.add(byjzTemp);
|
|
|
+ }
|
|
|
+ //如果有非本院记账的退款金额,非本院记账记录保持入库
|
|
|
+ if (notByjzAmount.compareTo(BigDecimal.ZERO) == 1) {
|
|
|
+ fullNewMzDepositFiles.add(temp);
|
|
|
+ }
|
|
|
+ if (!allRefund) {
|
|
|
+ MzDepositFile m = mzDepositFiles.get(0);
|
|
|
+ m.setTimes(times);
|
|
|
+ m.setReceiptNo(1);
|
|
|
+ m.setPayMark(PayMarkEnum.CHARGED.code);
|
|
|
+ m.setChargeDate(now);
|
|
|
+ m.setDcountNo(YesNoEnum.NO.code);
|
|
|
+ m.setDcountDate(null);
|
|
|
+ m.setOpId(opId);
|
|
|
+ m.setReceiptSn(serialNo);
|
|
|
+ m.setSerialNo(serialNo);
|
|
|
+ m.setPsordnum(null);
|
|
|
+ m.setAgtordnum(null);
|
|
|
+ m.setHisrefundnum(null);
|
|
|
+ //应付小于等于实际已经支付的非记账总额
|
|
|
+ if (totalPayable.compareTo(notByjzAmount) <= 0) {
|
|
|
+ m.setAmount(totalPayable);
|
|
|
+ m.setChequeType(Constants.CASH);
|
|
|
+ fullNewMzDepositFiles.add(m);
|
|
|
+ //应付大于实际已经支付的非记账总额,需要用记账收一部分
|
|
|
+ payWay = Constants.CASH;
|
|
|
+ newMzDepositFiles.add(m);
|
|
|
+ } else if (totalPayable.compareTo(notByjzAmount) == 1) {
|
|
|
+ m.setAmount(notByjzAmount);
|
|
|
+ m.setChequeType(Constants.CASH);
|
|
|
+ fullNewMzDepositFiles.add(m);
|
|
|
+ //复制一个本院记账的收款记录
|
|
|
+ MzDepositFile byjzNeedPayTemp = CloneUtil.clone(m);
|
|
|
+ byjzNeedPayTemp.setChequeType(Constants.BYJZ);
|
|
|
+ byjzNeedPayTemp.setAmount(totalPayable.subtract(notByjzAmount).setScale(1, BigDecimal.ROUND_HALF_UP));
|
|
|
+ fullNewMzDepositFiles.add(byjzNeedPayTemp);
|
|
|
+ newMzDepositFiles.add(m);
|
|
|
+ newMzDepositFiles.add(byjzNeedPayTemp);
|
|
|
+ payWay = Constants.BYJZ;
|
|
|
}
|
|
|
}
|
|
|
return payWay;
|
|
|
@@ -1565,7 +1573,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
List<MzChargeDetail> supplyFeeMzChargeDetails = new ArrayList<>();
|
|
|
//重新计算给药方式费用
|
|
|
// itemNo = formatSupplyFee(supplyFeeMzChargeDetails, newMzChargeDetailList, itemNo);
|
|
|
- formatPriceRoundDetail(new MzChargeDetail(mzDepositFileVo.getPatientId(), times), supplyFeeMzChargeDetails, mzPatientMi, newMzChargeDetailList, 127, itemNo, receiptNo,false);
|
|
|
+ formatPriceRoundDetail(new MzChargeDetail(mzDepositFileVo.getPatientId(), times), supplyFeeMzChargeDetails, mzPatientMi, newMzChargeDetailList, 127, itemNo, receiptNo, false);
|
|
|
// List<String> supplyList = supplyFeeMzChargeDetails.stream().filter(u -> StringUtils.isNotBlank(u.getChargeItemCode())).map-util.js(u -> u.getChargeItemCode()).collect(Collectors.toList());
|
|
|
// List<MzChargeDetail> removeList = new ArrayList<>();
|
|
|
// for (MzChargeDetail md : newMzChargeDetailList) {
|
|
|
@@ -1943,7 +1951,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
*/
|
|
|
private List<MzReceiptSerial> getMzReceiptSerials(String opId, MzDepositFileVo mzDepositFileVo, Date now, int serialNo) {
|
|
|
List<MzReceiptSerial> newList = new ArrayList<>();
|
|
|
- List<MzReceiptSerial> mzReceiptSerials = mzReceiptSerialMapper.selectReceiptDetails(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes(), mzDepositFileVo.getReceiptNo(),"mz_receipt_serial");
|
|
|
+ List<MzReceiptSerial> mzReceiptSerials = mzReceiptSerialMapper.selectReceiptDetails(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes(), mzDepositFileVo.getReceiptNo(), "mz_receipt_serial");
|
|
|
if (mzReceiptSerials != null && mzReceiptSerials.size() > 0) {
|
|
|
mzReceiptSerials.stream().forEach(j -> {
|
|
|
if (Constants.BYJZ.equals(j.getChequeType())) {
|
|
|
@@ -2015,7 +2023,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
*/
|
|
|
private List<MzDepositFile> getMzDepositFiles(MzDepositFileVo mzDepositFileVo, Date now, int serialNo, String opId) {
|
|
|
List<MzDepositFile> newList = new ArrayList<>();
|
|
|
- List<MzDepositFile> mzDepositFiles = mzDepositFileMapper.selectMzDepositFileByTimes(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes(), mzDepositFileVo.getReceiptNo(),"mz_deposit_file");
|
|
|
+ List<MzDepositFile> mzDepositFiles = mzDepositFileMapper.selectMzDepositFileByTimes(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes(), mzDepositFileVo.getReceiptNo(), "mz_deposit_file");
|
|
|
if (mzDepositFiles == null || mzDepositFiles.size() == 0) {
|
|
|
mzDepositFiles = mzDepositFileMapper.selectMzDepositFileByTimesInHisData(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes(), mzDepositFileVo.getReceiptNo());
|
|
|
}
|
|
|
@@ -2092,10 +2100,10 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
*
|
|
|
* @param mzChargeDetailList
|
|
|
* @param feeMap
|
|
|
- * @param needDiscount 是否需要做优惠计算
|
|
|
+ * @param needDiscount 是否需要做优惠计算
|
|
|
* @return
|
|
|
*/
|
|
|
- private BigDecimal getTotalPayable(List<MzChargeDetail> mzChargeDetailList, Map<String, BigDecimal> feeMap,boolean needDiscount) {
|
|
|
+ private BigDecimal getTotalPayable(List<MzChargeDetail> mzChargeDetailList, Map<String, BigDecimal> feeMap, boolean needDiscount) {
|
|
|
BigDecimal totalPayable = BigDecimal.ZERO;
|
|
|
if (mzChargeDetailList != null && mzChargeDetailList.size() > 0) {
|
|
|
for (MzChargeDetail mzChargeDetail : mzChargeDetailList) {
|
|
|
@@ -2106,24 +2114,24 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
BigDecimal unitPrice = mzChargeDetail.getUnitPrice() == null ? BigDecimal.ZERO : mzChargeDetail.getUnitPrice().setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
if (!Constants.TC.equals(mzChargeDetail.getBillItemCode()) && BigDecimal.ZERO.compareTo(unitPrice) == 0) {
|
|
|
unitPrice = BigDecimal.valueOf(0.01D);
|
|
|
- log.error("有为空的单价项目,费用明细具体如下{}",mzChargeDetail.toString());
|
|
|
+ log.error("有为空的单价项目,费用明细具体如下{}", mzChargeDetail.toString());
|
|
|
mzChargeDetail.setUnitPrice(unitPrice);
|
|
|
}
|
|
|
//进行营销折扣计算并写入库 优先申请科室的折扣率 医生系统做完移走开始
|
|
|
- if(needDiscount){
|
|
|
+ if (needDiscount) {
|
|
|
mzChargeDetail.setOrigPrice(unitPrice);
|
|
|
- Discount discount=null;
|
|
|
- if(StringUtils.isNotBlank(mzChargeDetail.getWarnDept())){
|
|
|
- discount= discountService.getDiscountRate(YesNoEnum.NO.code,mzChargeDetail.getWarnDept(),mzChargeDetail.getChargeItemCode());
|
|
|
+ Discount discount = null;
|
|
|
+ if (StringUtils.isNotBlank(mzChargeDetail.getWarnDept())) {
|
|
|
+ discount = discountService.getDiscountRate(YesNoEnum.NO.code, mzChargeDetail.getWarnDept(), mzChargeDetail.getChargeItemCode());
|
|
|
}
|
|
|
- if(discount==null && StringUtils.isNotBlank(mzChargeDetail.getExecDept())){
|
|
|
- discount= discountService.getDiscountRate(YesNoEnum.NO.code,mzChargeDetail.getExecDept(),mzChargeDetail.getChargeItemCode());
|
|
|
+ if (discount == null && StringUtils.isNotBlank(mzChargeDetail.getExecDept())) {
|
|
|
+ discount = discountService.getDiscountRate(YesNoEnum.NO.code, mzChargeDetail.getExecDept(), mzChargeDetail.getChargeItemCode());
|
|
|
}
|
|
|
- if(discount!=null){
|
|
|
- if(YesNoEnum.YES.code.equals(discount.getDiscountType())){
|
|
|
- unitPrice= discount.getDiscountRate().multiply(mzChargeDetail.getUnitPrice()).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
- }else {
|
|
|
- unitPrice=discount.getDiscountPrice();
|
|
|
+ if (discount != null) {
|
|
|
+ if (YesNoEnum.YES.code.equals(discount.getDiscountType())) {
|
|
|
+ unitPrice = discount.getDiscountRate().multiply(mzChargeDetail.getUnitPrice()).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ } else {
|
|
|
+ unitPrice = discount.getDiscountPrice();
|
|
|
}
|
|
|
mzChargeDetail.setUnitPrice(unitPrice);
|
|
|
}
|
|
|
@@ -2155,9 +2163,9 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
* @param mzChargeDetailList
|
|
|
* @param maxOrderNo
|
|
|
* @param itemNo
|
|
|
- * @param needDiscount 是否需要做优惠计算
|
|
|
+ * @param needDiscount 是否需要做优惠计算
|
|
|
*/
|
|
|
- private void formatPriceRoundDetail(MzChargeDetail mzChargeDetail, List<MzChargeDetail> mzChargeDetails, MzPatientMi mzPatientMi, List<MzChargeDetail> mzChargeDetailList, Integer maxOrderNo, Integer itemNo, Integer receiptNo,boolean needDiscount) {
|
|
|
+ private void formatPriceRoundDetail(MzChargeDetail mzChargeDetail, List<MzChargeDetail> mzChargeDetails, MzPatientMi mzPatientMi, List<MzChargeDetail> mzChargeDetailList, Integer maxOrderNo, Integer itemNo, Integer receiptNo, boolean needDiscount) {
|
|
|
List<MzChargeDetail> temp = new ArrayList<>();
|
|
|
temp.addAll(mzChargeDetailList);
|
|
|
temp.addAll(mzChargeDetails);
|
|
|
@@ -2166,7 +2174,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
//所有应收费用的明细 将所有费用按照类型归类
|
|
|
Map<String, BigDecimal> feeMap = new HashMap<>();
|
|
|
//实际应付金额
|
|
|
- getTotalPayable(temp, feeMap,needDiscount);
|
|
|
+ getTotalPayable(temp, feeMap, needDiscount);
|
|
|
for (String key : feeMap.keySet()) {
|
|
|
BigDecimal amount = feeMap.get(key).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
totalFee = totalFee.add(amount);
|