|
@@ -4,6 +4,7 @@ import cn.hnthyy.thmz.common.Constants;
|
|
|
import cn.hnthyy.thmz.entity.MzException;
|
|
|
import cn.hnthyy.thmz.entity.his.MzDepositFile;
|
|
|
import cn.hnthyy.thmz.entity.his.MzReceiptSerial;
|
|
|
+import cn.hnthyy.thmz.entity.his.MzVisitTable;
|
|
|
import cn.hnthyy.thmz.entity.thmz.Receipt;
|
|
|
import cn.hnthyy.thmz.entity.thmz.User;
|
|
|
import cn.hnthyy.thmz.enums.PayMarkEnum;
|
|
@@ -11,6 +12,7 @@ import cn.hnthyy.thmz.enums.YesNoEnum;
|
|
|
import cn.hnthyy.thmz.mapper.his.MzChargeDetailMapper;
|
|
|
import cn.hnthyy.thmz.mapper.his.MzDepositFileMapper;
|
|
|
import cn.hnthyy.thmz.mapper.his.MzReceiptSerialMapper;
|
|
|
+import cn.hnthyy.thmz.mapper.his.MzVisitTableMapper;
|
|
|
import cn.hnthyy.thmz.mapper.thmz.ReceiptMapper;
|
|
|
import cn.hnthyy.thmz.service.his.MzReceiptSerialService;
|
|
|
import cn.hnthyy.thmz.service.his.MzSerialNoService;
|
|
@@ -39,6 +41,9 @@ public class MzReceiptSerialServiceImpl implements MzReceiptSerialService {
|
|
|
@SuppressWarnings("all")
|
|
|
@Autowired
|
|
|
private MzDepositFileMapper mzDepositFileMapper;
|
|
|
+ @SuppressWarnings("all")
|
|
|
+ @Autowired
|
|
|
+ private MzVisitTableMapper mzVisitTableMapper;
|
|
|
@Autowired
|
|
|
private MzSerialNoService mzSerialNoService;
|
|
|
|
|
@@ -83,8 +88,8 @@ public class MzReceiptSerialServiceImpl implements MzReceiptSerialService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public MzReceiptSerial queryAllSerialForThisTime(String patientId, Integer times) {
|
|
|
- return mzReceiptSerialMapper.selectAllSerialForThisTime(patientId, times);
|
|
|
+ public MzReceiptSerial queryAllSerialForThisTime(String patientId, Integer times,Integer receiptNo) {
|
|
|
+ return mzReceiptSerialMapper.selectAllSerialForThisTime(patientId, times,receiptNo);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -93,8 +98,8 @@ public class MzReceiptSerialServiceImpl implements MzReceiptSerialService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<MzReceiptSerial> queryTallyReceiptSerialByIdAndTimes(String patientId, Integer times) {
|
|
|
- return mzReceiptSerialMapper.selectTallyReceiptSerialByIdAndTimes(patientId, times);
|
|
|
+ public List<MzReceiptSerial> queryTallyReceiptSerialByIdAndTimes(String patientId, Integer times,Integer receiptNo) {
|
|
|
+ return mzReceiptSerialMapper.selectTallyReceiptSerialByIdAndTimes(patientId, times,receiptNo);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -163,6 +168,11 @@ public class MzReceiptSerialServiceImpl implements MzReceiptSerialService {
|
|
|
if (receipt == null || StringUtils.isBlank(receipt.getReceiptCurrent())) {
|
|
|
throw new MzException("用户id=" + user.getUserName() + "没有可用的发票,请先维护发票。");
|
|
|
}
|
|
|
+ MzVisitTable mzVisitTable=mzVisitTableMapper.selectByPatientIdAndTimes(mzReceiptSerial.getPatientId(), mzReceiptSerial.getTimes());
|
|
|
+ if (mzVisitTable == null) {
|
|
|
+ throw new MzException("当前病人就诊基础资料【MzVisitTable】不存在,请检查");
|
|
|
+ }
|
|
|
+ Integer receiptNo = mzVisitTable.getReceiptNo() + 1;
|
|
|
Integer oriSerialNo = mzReceiptSerial.getSerialNo();
|
|
|
int serialNo = mzSerialNoService.getSerialNo();
|
|
|
//将原发票作废
|
|
@@ -172,7 +182,7 @@ public class MzReceiptSerialServiceImpl implements MzReceiptSerialService {
|
|
|
updateMzReceiptSerial.setChequeType(mzReceiptSerial.getChequeType());
|
|
|
mzReceiptSerialMapper.updateMzReceiptSerialByReceiptNo(updateMzReceiptSerial);
|
|
|
//创建新发票
|
|
|
- mzReceiptSerial.setReceiptNo(mzReceiptSerial.getReceiptNo() + 1);
|
|
|
+ mzReceiptSerial.setReceiptNo(receiptNo);
|
|
|
mzReceiptSerial.setSerialNo(serialNo);
|
|
|
mzReceiptSerial.setReceiptSn(serialNo);
|
|
|
mzReceiptSerial.setReceiptBill(receipt.getReceiptCurrent());
|
|
@@ -183,7 +193,7 @@ public class MzReceiptSerialServiceImpl implements MzReceiptSerialService {
|
|
|
mzReceiptSerialMapper.insertMzReceiptSerial(mzReceiptSerial);
|
|
|
//更新收费明细表发票流水号
|
|
|
Date now = new Date();
|
|
|
- mzChargeDetailMapper.updateBySerialNo(mzReceiptSerial.getReceiptNo(), mzReceiptSerial.getSerialNo(), oriSerialNo);
|
|
|
+ mzChargeDetailMapper.updateBySerialNo(receiptNo, mzReceiptSerial.getSerialNo(), oriSerialNo);
|
|
|
List<MzDepositFile> mzDepositFiles=mzDepositFileMapper.selectMzDepositFileBySerialNo(oriSerialNo);
|
|
|
//原收费方式记录设置为作废
|
|
|
mzDepositFileMapper.updatePayMark(PayMarkEnum.CANCELLATION.code,oriSerialNo);
|
|
@@ -206,6 +216,11 @@ public class MzReceiptSerialServiceImpl implements MzReceiptSerialService {
|
|
|
}
|
|
|
receipt.setUpdateDate(now);
|
|
|
receiptMapper.updateReceipt(receipt);
|
|
|
+ MzVisitTable updateMzVisitTable = new MzVisitTable();
|
|
|
+ updateMzVisitTable.setPatientId(mzReceiptSerial.getPatientId());
|
|
|
+ updateMzVisitTable.setTimes(mzReceiptSerial.getTimes());
|
|
|
+ updateMzVisitTable.setReceiptNo(receiptNo);
|
|
|
+ mzVisitTableMapper.updateMzVisitTable(updateMzVisitTable);
|
|
|
return mzReceiptSerial.getReceiptBill();
|
|
|
}
|
|
|
|