|
@@ -185,21 +185,21 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
mzChargeDetailPageDto.setTableName("mz_charge_detail");
|
|
|
String receiptSerialTableName = "mz_receipt_serial";
|
|
|
List<MzChargeDetail> mzChargeDetailList = mzChargeDetailMapper.selectMzChargeDetailWithPage(mzChargeDetailPageDto);
|
|
|
- List<MzChargeDetail> removeList=null;
|
|
|
+ List<MzChargeDetail> removeList = null;
|
|
|
for (MzChargeDetail mzChargeDetail : mzChargeDetailList) {
|
|
|
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())) {
|
|
|
- int num=mzChargeDetailMapper.selectRufundNumberByPatientIdAndTimesAndReceiptNo(mzChargeDetail.getPatientId(), mzChargeDetail.getTimes(), mzChargeDetail.getReceiptNo());
|
|
|
- if(num>0){
|
|
|
- if(removeList==null){
|
|
|
- removeList=new ArrayList<>();
|
|
|
- }
|
|
|
- removeList.add(mzChargeDetail);
|
|
|
- continue;
|
|
|
- }
|
|
|
+ int num = mzChargeDetailMapper.selectRufundNumberByPatientIdAndTimesAndReceiptNo(mzChargeDetail.getPatientId(), mzChargeDetail.getTimes(), mzChargeDetail.getReceiptNo());
|
|
|
+ if (num > 0) {
|
|
|
+ if (removeList == null) {
|
|
|
+ removeList = new ArrayList<>();
|
|
|
+ }
|
|
|
+ removeList.add(mzChargeDetail);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
List<MzReceiptSerial> mzReceiptSerials = mzReceiptSerialMapper.selectReceiptDetails(mzChargeDetail.getPatientId(), mzChargeDetail.getTimes(), mzChargeDetail.getReceiptNo(), receiptSerialTableName);
|
|
|
if (mzReceiptSerials != null && mzReceiptSerials.size() > 0) {
|
|
|
MzReceiptSerial mzReceiptSerial = mzReceiptSerials.get(0);
|
|
@@ -221,34 +221,34 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
mzChargeDetail.setPrintFlag("-" + YesNoEnum.YES.code.toString());
|
|
|
}
|
|
|
}
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
//没有发票需要打印
|
|
|
mzChargeDetail.setPrintFlag("-" + YesNoEnum.YES.code.toString());
|
|
|
}
|
|
|
mzChargeDetail.setCountYbZf(mzPatientMiMapper.countYbZf(mzChargeDetail.getPatientId(), mzChargeDetail.getTimes()));
|
|
|
- if(mzChargeDetail.getCountYbZf()<=0){
|
|
|
+ if (mzChargeDetail.getCountYbZf() <= 0) {
|
|
|
continue;
|
|
|
}
|
|
|
- Map<String,BigDecimal> ybAmountMap=mzPatientMiMapper.selectYbAmount(mzChargeDetail.getPatientId(), mzChargeDetail.getTimes());
|
|
|
- if(ybAmountMap==null || ybAmountMap.size()==0){
|
|
|
+ Map<String, BigDecimal> ybAmountMap = mzPatientMiMapper.selectYbAmount(mzChargeDetail.getPatientId(), mzChargeDetail.getTimes());
|
|
|
+ if (ybAmountMap == null || ybAmountMap.size() == 0) {
|
|
|
continue;
|
|
|
}
|
|
|
- BigDecimal fundPaySumamt=ybAmountMap.get("fund_pay_sumamt");
|
|
|
- BigDecimal acctPay=ybAmountMap.get("acct_pay");
|
|
|
- if(fundPaySumamt!=null && fundPaySumamt.compareTo(BigDecimal.ZERO)==1){
|
|
|
- if(mzDepositFileMapper.selectMzTcZfInfo(mzChargeDetail.getPatientId(), mzChargeDetail.getTimes(),mzChargeDetail.getReceiptNo())==0){
|
|
|
+ BigDecimal fundPaySumamt = ybAmountMap.get("fund_pay_sumamt");
|
|
|
+ BigDecimal acctPay = ybAmountMap.get("acct_pay");
|
|
|
+ if (fundPaySumamt != null && fundPaySumamt.compareTo(BigDecimal.ZERO) == 1) {
|
|
|
+ if (mzDepositFileMapper.selectMzTcZfInfo(mzChargeDetail.getPatientId(), mzChargeDetail.getTimes(), mzChargeDetail.getReceiptNo()) == 0) {
|
|
|
mzChargeDetail.setMztcbl(YesNoEnum.YES.code);
|
|
|
continue;
|
|
|
}
|
|
|
}
|
|
|
- if(acctPay!=null && acctPay.compareTo(BigDecimal.ZERO)==1){
|
|
|
- if(mzDepositFileMapper.selectMzTcZfGzInfo(mzChargeDetail.getPatientId(), mzChargeDetail.getTimes(),mzChargeDetail.getReceiptNo())==0){
|
|
|
+ if (acctPay != null && acctPay.compareTo(BigDecimal.ZERO) == 1) {
|
|
|
+ if (mzDepositFileMapper.selectMzTcZfGzInfo(mzChargeDetail.getPatientId(), mzChargeDetail.getTimes(), mzChargeDetail.getReceiptNo()) == 0) {
|
|
|
mzChargeDetail.setMztcbl(YesNoEnum.YES.code);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if(removeList!=null){
|
|
|
+ if (removeList != null) {
|
|
|
mzChargeDetailList.removeAll(removeList);
|
|
|
}
|
|
|
return mzChargeDetailList;
|
|
@@ -336,8 +336,8 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
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));
|
|
|
- Clinic clinic=clinicMapper.selectByPatientIdAndTimesAndReceiptNo(mzChargeDetail.getPatientId(),mzChargeDetail.getTimes(),0);
|
|
|
- returnMzChargeDetail.setCountYbZf((clinic==null|| clinic.getZgmztczf()==null)?0:clinic.getZgmztczf());
|
|
|
+ Clinic clinic = clinicMapper.selectByPatientIdAndTimesAndReceiptNo(mzChargeDetail.getPatientId(), mzChargeDetail.getTimes(), 0);
|
|
|
+ returnMzChargeDetail.setCountYbZf((clinic == null || clinic.getZgmztczf() == null) ? 0 : clinic.getZgmztczf());
|
|
|
// Map<String, Object> insuinfoMap = tsmzService.queryInsuinfo(Constants.BRZZJF_CODE, mzChargeDetail.getPatientId());
|
|
|
// if (insuinfoMap != null && insuinfoMap.size() > 0) {
|
|
|
// if (Integer.valueOf(0).equals(insuinfoMap.get("code"))) {
|
|
@@ -893,7 +893,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
throw new MzException("当前病人本次处方已经成功缴费,无需重复缴费");
|
|
|
}
|
|
|
//如果当前数据是在备份库中,那么就会还原到正式库
|
|
|
- // List<MzChargeDetail> mzChargeDetailList = mzChargeDetailMapper.selectByPatientIdAndTimesAndReceiptNo(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes(), mzDepositFileVo.getReceiptNo());
|
|
|
+ // 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) {
|
|
@@ -903,7 +903,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
// mzChargeDetailMapper.updateMzChargeDetailFull(mzChargeDetail);
|
|
|
// }
|
|
|
//本院记账需要把原缴费记录保存
|
|
|
- List<MzChargeDetail> mzChargeDetailList = mzChargeDetailMapper.selectByPatientIdAndTimesAndReceiptNo(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes(), mzDepositFileVo.getReceiptNo());
|
|
|
+ List<MzChargeDetail> mzChargeDetailList = mzChargeDetailMapper.selectByPatientIdAndTimesAndReceiptNo(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes(), mzDepositFileVo.getReceiptNo());
|
|
|
mzDepositFileService.batchSaveMzDepositFile(newMzDepositFileList);
|
|
|
List<MzReceiptSerial> newMzReceiptSerialList = getMzReceiptSerials(opId, mzDepositFileVo, now, serialNo);
|
|
|
mzReceiptSerialService.batchSaveMzReceiptSerial(newMzReceiptSerialList);
|
|
@@ -1192,7 +1192,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
clinic.setExpContent(mzPrescriptionVo.getExpContent());
|
|
|
clinicMapper.insertClinic(clinic);
|
|
|
if (mzPrescriptionVo.getZgmztczf() != null && YesNoEnum.YES.code.equals(mzPrescriptionVo.getZgmztczf())) {
|
|
|
- tsmzService.directRegistrationAsync(opId, mzPatientMi.getPatientId(), times, mzPrescriptionVo.getReadCardResult(), mzPrescriptionVo.getGrzhzf(), mzPrescriptionVo.getReadCardType(),mzPrescriptionVo.getExpContent());
|
|
|
+ tsmzService.directRegistrationAsync(opId, mzPatientMi.getPatientId(), times, mzPrescriptionVo.getReadCardResult(), mzPrescriptionVo.getGrzhzf(), mzPrescriptionVo.getReadCardType(), mzPrescriptionVo.getExpContent());
|
|
|
}
|
|
|
return clinic;
|
|
|
}
|
|
@@ -1518,7 +1518,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
if (mzChargeDetail.getGroupOrder() == null) {
|
|
|
mzChargeDetail.setGroupOrder(1);
|
|
|
}
|
|
|
- xyDetail.put("orderCode", mzChargeDetail.getChargeItemCode() + "_" + mzChargeDetail.getSerial() + "_" + mzChargeDetail.getGroupOrder()+ "_" + mzChargeDetail.getOrderNo());
|
|
|
+ xyDetail.put("orderCode", mzChargeDetail.getChargeItemCode() + "_" + mzChargeDetail.getSerial() + "_" + mzChargeDetail.getGroupOrder() + "_" + mzChargeDetail.getOrderNo());
|
|
|
xyDetail.put("groupOrder", mzChargeDetail.getGroupOrder());
|
|
|
if (StringUtils.isNotBlank(ypZdDict.getManuCode())) {
|
|
|
String manufactoryName = ypZdManufactoryService.queryYpZdManufactoryByCode(ypZdDict.getManuCode());
|
|
@@ -1552,7 +1552,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(mzChargeDetail.getTryFlag()) && YesNoEnum.YES.code.toString().equals(mzChargeDetail.getTryFlag())) {
|
|
|
xyDetail.put("tryFlag", "皮试");
|
|
|
- }else if (StringUtils.isNotBlank(mzChargeDetail.getTryResult())) {
|
|
|
+ } else if (StringUtils.isNotBlank(mzChargeDetail.getTryResult())) {
|
|
|
if (MzChargeDetail.NEGATIVE_TRY_RESULT.equals(mzChargeDetail.getTryResult())) {
|
|
|
xyDetail.put("tryResult", "阴性");
|
|
|
} else if (MzChargeDetail.EXCUSED_EXAMINATION_TRY_RESULT.equals(mzChargeDetail.getTryResult())) {
|
|
@@ -1580,28 +1580,28 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
}
|
|
|
}
|
|
|
zyDetail.put("bedNo", mzZyReq.getBedNo());
|
|
|
- String conditionCode=null;
|
|
|
- if(Integer.valueOf(1).equals(mzZyReq.getConditionCode())){
|
|
|
- conditionCode="有";
|
|
|
- }else if(Integer.valueOf(2).equals(mzZyReq.getConditionCode())){
|
|
|
- conditionCode="临床未确定";
|
|
|
- }else if(Integer.valueOf(3).equals(mzZyReq.getConditionCode())){
|
|
|
- conditionCode="情况不明";
|
|
|
- }else if(Integer.valueOf(4).equals(mzZyReq.getConditionCode())){
|
|
|
- conditionCode="无";
|
|
|
- }
|
|
|
- zyDetail.put("conditionCode",conditionCode);
|
|
|
- String routeOfAdmission=null;
|
|
|
- if(Integer.valueOf(1).equals(mzZyReq.getConditionCode())){
|
|
|
- routeOfAdmission="急诊";
|
|
|
- }else if(Integer.valueOf(2).equals(mzZyReq.getConditionCode())){
|
|
|
- routeOfAdmission="门诊";
|
|
|
- }else if(Integer.valueOf(3).equals(mzZyReq.getConditionCode())){
|
|
|
- routeOfAdmission="其他医疗机构转入";
|
|
|
- }else if(Integer.valueOf(9).equals(mzZyReq.getConditionCode())){
|
|
|
- routeOfAdmission="其他";
|
|
|
- }
|
|
|
- zyDetail.put("routeOfAdmission",routeOfAdmission);
|
|
|
+ String conditionCode = null;
|
|
|
+ if (Integer.valueOf(1).equals(mzZyReq.getConditionCode())) {
|
|
|
+ conditionCode = "有";
|
|
|
+ } else if (Integer.valueOf(2).equals(mzZyReq.getConditionCode())) {
|
|
|
+ conditionCode = "临床未确定";
|
|
|
+ } else if (Integer.valueOf(3).equals(mzZyReq.getConditionCode())) {
|
|
|
+ conditionCode = "情况不明";
|
|
|
+ } else if (Integer.valueOf(4).equals(mzZyReq.getConditionCode())) {
|
|
|
+ conditionCode = "无";
|
|
|
+ }
|
|
|
+ zyDetail.put("conditionCode", conditionCode);
|
|
|
+ String routeOfAdmission = null;
|
|
|
+ if (Integer.valueOf(1).equals(mzZyReq.getConditionCode())) {
|
|
|
+ routeOfAdmission = "急诊";
|
|
|
+ } else if (Integer.valueOf(2).equals(mzZyReq.getConditionCode())) {
|
|
|
+ routeOfAdmission = "门诊";
|
|
|
+ } else if (Integer.valueOf(3).equals(mzZyReq.getConditionCode())) {
|
|
|
+ routeOfAdmission = "其他医疗机构转入";
|
|
|
+ } else if (Integer.valueOf(9).equals(mzZyReq.getConditionCode())) {
|
|
|
+ routeOfAdmission = "其他";
|
|
|
+ }
|
|
|
+ zyDetail.put("routeOfAdmission", routeOfAdmission);
|
|
|
prescriptionDetail.put("zyReqPrescription", zyDetail);
|
|
|
}
|
|
|
mzPrescriptionVo.getMzBlRecord().setPrescriptionDetail(JsonUtil.object2Json(prescriptionDetail));
|
|
@@ -1966,7 +1966,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
List<Map<String, Object>> detail = (List<Map<String, Object>>) map.get("detail");
|
|
|
if (detail.size() > 0) {
|
|
|
for (Map<String, Object> detailMap : detail) {
|
|
|
- sbd.append(detailMap.get("index")).append(".").append(detailMap.get("name")) .append(" X 总量:") .append(detailMap.get("quantity") == null ? "" : detailMap.get("quantity")).append("</br>");
|
|
|
+ sbd.append(detailMap.get("index")).append(".").append(detailMap.get("name")).append(" X 总量:").append(detailMap.get("quantity") == null ? "" : detailMap.get("quantity")).append("</br>");
|
|
|
sbd.append(" 单量:").append(detailMap.get("drugQuan") == null ? "" : detailMap.get("drugQuan")).append(" 频率:")
|
|
|
.append(detailMap.get("frequency") == null ? "" : detailMap.get("frequency")).append(" 天数:")
|
|
|
.append(detailMap.get("orderDays") == null ? "" : detailMap.get("orderDays")).append("</br>");
|
|
@@ -2293,24 +2293,24 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
}
|
|
|
MzZyReq mzZyReq = mzPrescriptionVo.getMzZyReq();
|
|
|
if (mzZyReq != null && mzZyReq.getReqDept() != null && StringUtils.isNotBlank(mzZyReq.getReqDept())) {
|
|
|
- if(needPatient ){
|
|
|
- if(mzPrescriptionVo.getIcdCode()==null || StringUtils.isBlank(mzPrescriptionVo.getIcdCode())){
|
|
|
+ if (needPatient) {
|
|
|
+ if (mzPrescriptionVo.getIcdCode() == null || StringUtils.isBlank(mzPrescriptionVo.getIcdCode())) {
|
|
|
throw new MzException("保存处方失败,开立住院证必须是标准诊断!");
|
|
|
}
|
|
|
- int count=0;
|
|
|
+ int count = 0;
|
|
|
List<String> arr = Arrays.asList(mzPrescriptionVo.getIcdCode().split(","));
|
|
|
- for(String str:arr){
|
|
|
- if(str!=null && StringUtils.isNotBlank(str)){
|
|
|
+ for (String str : arr) {
|
|
|
+ if (str != null && StringUtils.isNotBlank(str)) {
|
|
|
count++;
|
|
|
}
|
|
|
}
|
|
|
- if(count>1){
|
|
|
+ if (count > 1) {
|
|
|
throw new MzException("保存处方失败,开立住院证只允许一个标准诊断!");
|
|
|
}
|
|
|
- if(mzZyReq.getConditionCode()==null){
|
|
|
+ if (mzZyReq.getConditionCode() == null) {
|
|
|
throw new MzException("保存处方失败,住院证入院病情代码不能为空!");
|
|
|
}
|
|
|
- if(mzZyReq.getRouteOfAdmission()==null){
|
|
|
+ if (mzZyReq.getRouteOfAdmission() == null) {
|
|
|
throw new MzException("保存处方失败,住院证入院途径代码不能为空!");
|
|
|
}
|
|
|
|
|
@@ -2420,69 +2420,69 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
@Override
|
|
|
public int modifyManuNo(List<MzChargeDetail> mzChargeDetails) {
|
|
|
mzChargeDetails.forEach(mzChargeDetail -> {
|
|
|
- mzChargeDetailMapper.updateManuNo(mzChargeDetail.getManuNo(),mzChargeDetail.getRealNo(),mzChargeDetail.getOrderNo(),mzChargeDetail.getItemNo());
|
|
|
- if(mzChargeDetail.getConfirmFlag() == 1){//已发药,修改发药记录
|
|
|
- ypMzFytjMapper.updateManuNo(mzChargeDetail.getManuNo(),mzChargeDetail.getRealNo(),mzChargeDetail.getOrderNo(),mzChargeDetail.getItemNo());
|
|
|
+ mzChargeDetailMapper.updateManuNo(mzChargeDetail.getManuNo(), mzChargeDetail.getRealNo(), mzChargeDetail.getOrderNo(), mzChargeDetail.getItemNo());
|
|
|
+ if (mzChargeDetail.getConfirmFlag() == 1) {//已发药,修改发药记录
|
|
|
+ ypMzFytjMapper.updateManuNo(mzChargeDetail.getManuNo(), mzChargeDetail.getRealNo(), mzChargeDetail.getOrderNo(), mzChargeDetail.getItemNo());
|
|
|
}
|
|
|
});
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Map<String,BigDecimal> mztcblInfo(String patientId, Integer times, Integer receiptNo) throws MzException {
|
|
|
- BigDecimal totalAmount=mzChargeDetailMapper.selectSumAmount(patientId,times,receiptNo);
|
|
|
- if(totalAmount==null){
|
|
|
+ public Map<String, BigDecimal> mztcblInfo(String patientId, Integer times, Integer receiptNo) throws MzException {
|
|
|
+ BigDecimal totalAmount = mzChargeDetailMapper.selectSumAmount(patientId, times, receiptNo);
|
|
|
+ if (totalAmount == null) {
|
|
|
throw new MzException("该患者本次门诊处方没有产生任何费用!");
|
|
|
}
|
|
|
- Map<String,BigDecimal> map=mzPatientMiMapper.selectYbAmount(patientId, times);
|
|
|
- if(map==null){
|
|
|
+ Map<String, BigDecimal> map = mzPatientMiMapper.selectYbAmount(patientId, times);
|
|
|
+ if (map == null) {
|
|
|
throw new MzException("该患者本次门诊处方没有门诊统筹费用补录信息!");
|
|
|
}
|
|
|
- map.put("totalAmount",totalAmount.setScale(2, BigDecimal.ROUND_HALF_UP));
|
|
|
+ map.put("totalAmount", totalAmount.setScale(2, BigDecimal.ROUND_HALF_UP));
|
|
|
BigDecimal fundPaySumamt = map.get("fund_pay_sumamt");
|
|
|
BigDecimal acctPay = map.get("acct_pay");
|
|
|
- if(fundPaySumamt==null){
|
|
|
- fundPaySumamt=BigDecimal.ZERO;
|
|
|
+ if (fundPaySumamt == null) {
|
|
|
+ fundPaySumamt = BigDecimal.ZERO;
|
|
|
}
|
|
|
- if(acctPay==null){
|
|
|
- acctPay=BigDecimal.ZERO;
|
|
|
+ if (acctPay == null) {
|
|
|
+ acctPay = BigDecimal.ZERO;
|
|
|
}
|
|
|
- if(BigDecimal.ZERO.compareTo(fundPaySumamt)==0 && BigDecimal.ZERO.compareTo(acctPay)==0){
|
|
|
+ if (BigDecimal.ZERO.compareTo(fundPaySumamt) == 0 && BigDecimal.ZERO.compareTo(acctPay) == 0) {
|
|
|
throw new MzException("该患者本次门诊处方统筹补录后医保记账与个人账户支付金额均未产生实际费用,无须进行补录操作!!");
|
|
|
}
|
|
|
- BigDecimal refundFee =fundPaySumamt.add(acctPay).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
- map.put("refundFee",refundFee);
|
|
|
+ BigDecimal refundFee = fundPaySumamt.add(acctPay).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ map.put("refundFee", refundFee);
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, timeout = 36000, rollbackFor = Exception.class)
|
|
|
public int chargeFeeForMztcbl(String patientId, Integer times, Integer receiptNo, User user) throws MzException {
|
|
|
- BigDecimal byjzAmount=mzDepositFileMapper.selectByjzASmount(patientId,times,receiptNo);
|
|
|
- if(byjzAmount!=null&& byjzAmount.compareTo(BigDecimal.ZERO)>0){
|
|
|
+ BigDecimal byjzAmount = mzDepositFileMapper.selectByjzASmount(patientId, times, receiptNo);
|
|
|
+ if (byjzAmount != null && byjzAmount.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
throw new MzException("该患者本次门诊处方仍有本院记账未收,请先将本院记账欠款补交!");
|
|
|
}
|
|
|
- if(mzDepositFileMapper.selectMzTcZfInfo(patientId,times,receiptNo)>0){
|
|
|
+ if (mzDepositFileMapper.selectMzTcZfInfo(patientId, times, receiptNo) > 0) {
|
|
|
throw new MzException("该患者本次门诊处方已经进行了门诊统筹补录,请勿重复操作!");
|
|
|
}
|
|
|
PayInfo payInfo = tsmzService.uploadFees(user.getUserIdCode(), patientId, times, receiptNo);
|
|
|
- if(payInfo == null){
|
|
|
+ if (payInfo == null) {
|
|
|
throw new MzException("获取门诊统筹/特门费用失败!");
|
|
|
}
|
|
|
- if(payInfo.getCode() != 0){
|
|
|
+ if (payInfo.getCode() != 0) {
|
|
|
throw new MzException(payInfo.getErrorMessage());
|
|
|
}
|
|
|
- if(payInfo.getFundPay() ==null || payInfo.getFundPay().compareTo(BigDecimal.ZERO)<=0){
|
|
|
+ if (payInfo.getFundPay() == null || payInfo.getFundPay().compareTo(BigDecimal.ZERO) <= 0) {
|
|
|
throw new MzException("门诊统筹金额为空,无需进行补录操作!");
|
|
|
}
|
|
|
- BigDecimal totalAmount=mzChargeDetailMapper.selectSumAmount(patientId,times,receiptNo);
|
|
|
- if(totalAmount==null){
|
|
|
- totalAmount=BigDecimal.ZERO;
|
|
|
+ BigDecimal totalAmount = mzChargeDetailMapper.selectSumAmount(patientId, times, receiptNo);
|
|
|
+ if (totalAmount == null) {
|
|
|
+ totalAmount = BigDecimal.ZERO;
|
|
|
}
|
|
|
- totalAmount=totalAmount.setScale(1, BigDecimal.ROUND_HALF_UP);
|
|
|
+ totalAmount = totalAmount.setScale(1, BigDecimal.ROUND_HALF_UP);
|
|
|
Date now = new Date();
|
|
|
int serialNo = mzSerialNoService.getSerialNo();
|
|
|
- List<MzDepositFile> newMzDepositFileList = getMzDepositFiles(patientId, times, receiptNo,payInfo, now, serialNo, user.getUserIdCode(),totalAmount);
|
|
|
+ List<MzDepositFile> newMzDepositFileList = getMzDepositFiles(patientId, times, receiptNo, payInfo, now, serialNo, user.getUserIdCode(), totalAmount);
|
|
|
if (newMzDepositFileList.size() > 0 && mzDepositFileMapper.selectBySameParams(newMzDepositFileList.get(0)) > 0) {
|
|
|
throw new MzException("当前病人本次处方已经成功缴费,无需重复缴费");
|
|
|
}
|
|
@@ -2491,13 +2491,13 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
//本院记账需要把原缴费记录保存
|
|
|
List<MzChargeDetail> mzChargeDetailList = mzChargeDetailMapper.selectByPatientIdAndTimesAndReceiptNo(patientId, times, receiptNo);
|
|
|
mzDepositFileService.batchSaveMzDepositFile(newMzDepositFileList);
|
|
|
- List<MzReceiptSerial> newMzReceiptSerialList = getMzReceiptSerials(user.getUserIdCode(), patientId, times, receiptNo,payInfo, now, serialNo,totalAmount);
|
|
|
+ List<MzReceiptSerial> newMzReceiptSerialList = getMzReceiptSerials(user.getUserIdCode(), patientId, times, receiptNo, payInfo, now, serialNo, totalAmount);
|
|
|
mzReceiptSerialService.batchSaveMzReceiptSerial(newMzReceiptSerialList);
|
|
|
//将新生成的收费流水号设置到收费明细
|
|
|
mzChargeDetail.setSerialNo(serialNo);
|
|
|
mzChargeDetail.setRealNo(serialNo);
|
|
|
mzChargeDetail.setReceiptNo(receiptNo);
|
|
|
- mzChargeDetail.setNewReceiptNo(receiptNo+1);
|
|
|
+ mzChargeDetail.setNewReceiptNo(receiptNo + 1);
|
|
|
//如果有发药队列,修改发药统计的流水号
|
|
|
MzYpFydl mzYpFydl = new MzYpFydl();
|
|
|
mzYpFydl.setSerialNo(serialNo);
|
|
@@ -2546,10 +2546,10 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
throw new MzException("您在今天已经采过样了,请不要重复申请!");
|
|
|
}
|
|
|
|
|
|
- String title="核酸单人单管申请";
|
|
|
- String hybirdNumberKey="single_hybird_number";
|
|
|
- String hybirdTimeKey="single_hybird_time";
|
|
|
- int totalNum=mzYjReqMapper.selectTotalReqByCode(DateUtil.getFirstSecond(),DateUtil.getLastSecond());
|
|
|
+ String title = "核酸单人单管申请";
|
|
|
+ String hybirdNumberKey = "single_hybird_number";
|
|
|
+ String hybirdTimeKey = "single_hybird_time";
|
|
|
+ int totalNum = mzYjReqMapper.selectTotalReqByCode(DateUtil.getFirstSecond(), DateUtil.getLastSecond());
|
|
|
checkHybrid(title, hybirdNumberKey, hybirdTimeKey, totalNum);
|
|
|
//自助开核酸的时候更新病人年龄
|
|
|
if (mzPatientMi.getBirthDay() != null) {
|
|
@@ -2607,11 +2607,11 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
if (num > 0) {
|
|
|
throw new MzException("您在今天已经采过样了,请不要重复申请!");
|
|
|
}
|
|
|
- String title="混采";
|
|
|
- String hybirdNumberKey="hybird_number";
|
|
|
- String hybirdTimeKey="hybird_time";
|
|
|
- int totalNum=mzChargeDetailMapper.selectTotalReqByCode(Constants.HYBRID_TEST_CHARGE_CODE,DateUtil.getFirstSecond(),DateUtil.getLastSecond());
|
|
|
- checkHybrid(title, hybirdNumberKey, hybirdTimeKey, totalNum/personNumber);
|
|
|
+ String title = "混采";
|
|
|
+ String hybirdNumberKey = "hybird_number";
|
|
|
+ String hybirdTimeKey = "hybird_time";
|
|
|
+ int totalNum = mzChargeDetailMapper.selectTotalReqByCode(Constants.HYBRID_TEST_CHARGE_CODE, DateUtil.getFirstSecond(), DateUtil.getLastSecond());
|
|
|
+ checkHybrid(title, hybirdNumberKey, hybirdTimeKey, totalNum / personNumber);
|
|
|
//自助开核酸的时候更新病人年龄
|
|
|
if (mzPatientMi.getBirthDay() != null) {
|
|
|
int age = DateUtil.getAge(mzPatientMi.getBirthDay());
|
|
@@ -2672,6 +2672,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
|
|
|
/**
|
|
|
* 校验核酸申请是否已经达到最大值
|
|
|
+ *
|
|
|
* @param title
|
|
|
* @param hybirdNumberKey
|
|
|
* @param hybirdTimeKey
|
|
@@ -2679,25 +2680,25 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
* @throws MzException
|
|
|
*/
|
|
|
private void checkHybrid(String title, String hybirdNumberKey, String hybirdTimeKey, int totalNum) throws MzException {
|
|
|
- Config config=configMapper.selectUserByKey(hybirdNumberKey);
|
|
|
- if(config==null || StringUtils.isBlank(config.getConfigValue())){
|
|
|
- throw new MzException(title+"最大数参数为空!");
|
|
|
+ Config config = configMapper.selectUserByKey(hybirdNumberKey);
|
|
|
+ if (config == null || StringUtils.isBlank(config.getConfigValue())) {
|
|
|
+ throw new MzException(title + "最大数参数为空!");
|
|
|
}
|
|
|
- Integer hybirdNumber =Integer.valueOf(config.getConfigValue());
|
|
|
- if(totalNum>=hybirdNumber){
|
|
|
- throw new MzException("抱歉,"+title+"人数以达到最大数值,无法继续采样!");
|
|
|
+ Integer hybirdNumber = Integer.valueOf(config.getConfigValue());
|
|
|
+ if (totalNum >= hybirdNumber) {
|
|
|
+ throw new MzException("抱歉," + title + "人数以达到最大数值,无法继续采样!");
|
|
|
}
|
|
|
- config=configMapper.selectUserByKey(hybirdTimeKey);
|
|
|
- if(config==null || StringUtils.isBlank(config.getConfigValue())){
|
|
|
- throw new MzException(title+"时间参数为空!");
|
|
|
+ config = configMapper.selectUserByKey(hybirdTimeKey);
|
|
|
+ if (config == null || StringUtils.isBlank(config.getConfigValue())) {
|
|
|
+ throw new MzException(title + "时间参数为空!");
|
|
|
}
|
|
|
- String [] arr =config.getConfigValue().replaceAll(":","").split("-");
|
|
|
- if(arr==null || arr.length!=2){
|
|
|
- throw new MzException(title+"时间参数错误!");
|
|
|
+ String[] arr = config.getConfigValue().replaceAll(":", "").split("-");
|
|
|
+ if (arr == null || arr.length != 2) {
|
|
|
+ throw new MzException(title + "时间参数错误!");
|
|
|
}
|
|
|
- Integer currentTimes = Integer.valueOf(DateUtil.fomart(new Date(),"HH:mm").replace(":",""));
|
|
|
- if(currentTimes<Integer.valueOf(arr[0]) || currentTimes> Integer.valueOf(arr[1])){
|
|
|
- throw new MzException("当前时间段无法进行"+title+",请选择其他核酸检验或者改日进行!");
|
|
|
+ Integer currentTimes = Integer.valueOf(DateUtil.fomart(new Date(), "HH:mm").replace(":", ""));
|
|
|
+ if (currentTimes < Integer.valueOf(arr[0]) || currentTimes > Integer.valueOf(arr[1])) {
|
|
|
+ throw new MzException("当前时间段无法进行" + title + ",请选择其他核酸检验或者改日进行!");
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -2914,7 +2915,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
mzPrescriptionVo.setIcdCode(mzVisitTable.getIcdCode());
|
|
|
String icdText = StringUtils.isBlank(mzBlRecord.getTentativeDiagnosis()) ? "" : mzBlRecord.getTentativeDiagnosis();
|
|
|
if (mzVisitTable != null && mzVisitTable.getIcdText() != null && StringUtils.isNotBlank(mzVisitTable.getIcdText())) {
|
|
|
- icdText= mzVisitTable.getIcdText()+" "+icdText;
|
|
|
+ icdText = mzVisitTable.getIcdText() + " " + icdText;
|
|
|
}
|
|
|
//诊断太长导致处方分页
|
|
|
if (icdText.length() > 60) {
|
|
@@ -3190,7 +3191,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
resultMap.put("mzBlRecord", mzBlRecord);
|
|
|
String icdText = StringUtils.isBlank(mzBlRecord.getTentativeDiagnosis()) ? "" : mzBlRecord.getTentativeDiagnosis();
|
|
|
if (mzVisitTable != null && mzVisitTable.getIcdText() != null && StringUtils.isNotBlank(mzVisitTable.getIcdText())) {
|
|
|
- icdText= mzVisitTable.getIcdText()+" "+icdText;
|
|
|
+ icdText = mzVisitTable.getIcdText() + " " + icdText;
|
|
|
}
|
|
|
resultMap.put("icdText", icdText);
|
|
|
return resultMap;
|
|
@@ -3400,18 +3401,18 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
updateMzChargeDetail.setReceiptNo(mzDepositFileVo.getReceiptNo());
|
|
|
updateMzChargeDetail.setConfirmFlag(ConfirmFlagEnum.CANCEL.code);
|
|
|
mzChargeDetailMapper.updateMzChargeDetailFull(updateMzChargeDetail);
|
|
|
- BigDecimal totalAmount=mzChargeDetailMapper.selectSumAmount(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes(), mzDepositFileVo.getReceiptNo());
|
|
|
- if(totalAmount!=null){
|
|
|
- totalAmount=totalAmount.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ BigDecimal totalAmount = mzChargeDetailMapper.selectSumAmount(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes(), mzDepositFileVo.getReceiptNo());
|
|
|
+ if (totalAmount != null) {
|
|
|
+ totalAmount = totalAmount.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
}
|
|
|
//本院记账重收的时候。新的收费方式与老的部分收费方式的receiptNo 不一致,所以加这个逻辑
|
|
|
- BigDecimal tempAmount=mzDepositFileMapper.selectSumAmount(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes(), mzDepositFileVo.getReceiptNo());
|
|
|
- if(tempAmount!=null){
|
|
|
- tempAmount=tempAmount.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ BigDecimal tempAmount = mzDepositFileMapper.selectSumAmount(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes(), mzDepositFileVo.getReceiptNo());
|
|
|
+ if (tempAmount != null) {
|
|
|
+ tempAmount = tempAmount.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
}
|
|
|
List<MzReceiptSerial> mzReceiptSerials = mzReceiptSerialMapper.selectSerialForThisTime(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes(), mzDepositFileVo.getReceiptNo());
|
|
|
- if(totalAmount.compareTo(tempAmount)>0){
|
|
|
- mzReceiptSerials=mzReceiptSerialMapper.selectReceiptDetailsWithOutByjz(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes());
|
|
|
+ if (totalAmount.compareTo(tempAmount) > 0) {
|
|
|
+ mzReceiptSerials = mzReceiptSerialMapper.selectReceiptDetailsWithOutByjz(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes());
|
|
|
}
|
|
|
if (mzReceiptSerials != null && mzReceiptSerials.size() > 0) {
|
|
|
List<MzReceiptSerial> newReceiptSerials = formatRefundReceiptSerial(mzReceiptSerials, opId);
|
|
@@ -3433,10 +3434,10 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
int oriTimes = mzDepositFileVo.getTimes();
|
|
|
if (allRefund) {
|
|
|
getDeposFiles(opId, mzDepositFileVo, now, 0, 0, totalAmount, fullNewMzDepositFiles, allRefund, null);
|
|
|
- if(fullNewMzDepositFiles.size()>0){
|
|
|
- //新增收费方式记录 退费的负数冲抵部分
|
|
|
- mzDepositFileMapper.batchInsertMzDepositFile(fullNewMzDepositFiles);
|
|
|
- }
|
|
|
+ if (fullNewMzDepositFiles.size() > 0) {
|
|
|
+ //新增收费方式记录 退费的负数冲抵部分
|
|
|
+ mzDepositFileMapper.batchInsertMzDepositFile(fullNewMzDepositFiles);
|
|
|
+ }
|
|
|
times = 0;
|
|
|
if (count > 0) {
|
|
|
//PayInfo result=
|
|
@@ -3444,7 +3445,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
if (result == null) {
|
|
|
throw new MzException("退费失败,特门退费失败!");
|
|
|
}
|
|
|
- if(result.getCode() != 0){
|
|
|
+ if (result.getCode() != 0) {
|
|
|
throw new MzException(result.getErrorMessage());
|
|
|
}
|
|
|
}
|
|
@@ -3658,9 +3659,9 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
private void getDeposFiles(String opId, MzDepositFileVo mzDepositFileVo, Date now, int times, int serialNo, BigDecimal totalPayable, List<MzDepositFile> fullNewMzDepositFiles, boolean allRefund, List<MzDepositFile> newMzDepositFiles) {
|
|
|
List<MzDepositFile> mzDepositFiles = mzDepositFileMapper.selectMzDepositFileByTimes(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes(), mzDepositFileVo.getReceiptNo(), "mz_deposit_file");
|
|
|
//本院记账重收的时候。新的收费方式与老的部分收费方式的receiptNo 不一致,所以加这个逻辑
|
|
|
- BigDecimal tempAmount=mzDepositFileMapper.selectSumAmount(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes(), mzDepositFileVo.getReceiptNo());
|
|
|
- if(totalPayable.compareTo(tempAmount)>0){
|
|
|
- mzDepositFiles=mzDepositFileMapper.selectMzDepositFileByTimesWithOutByjz(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes());
|
|
|
+ BigDecimal tempAmount = mzDepositFileMapper.selectSumAmount(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes(), mzDepositFileVo.getReceiptNo());
|
|
|
+ if (totalPayable.compareTo(tempAmount) > 0) {
|
|
|
+ mzDepositFiles = mzDepositFileMapper.selectMzDepositFileByTimesWithOutByjz(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes());
|
|
|
}
|
|
|
if (mzDepositFiles == null || mzDepositFiles.size() == 0) {
|
|
|
return;
|
|
@@ -3671,22 +3672,22 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
BigDecimal ybjzAmount = BigDecimal.ZERO;
|
|
|
//非本院记账总额
|
|
|
BigDecimal notByjzAmount = BigDecimal.ZERO;
|
|
|
- MzDepositFile temp =null;
|
|
|
+ MzDepositFile temp = null;
|
|
|
for (MzDepositFile ms : mzDepositFiles) {
|
|
|
if (ms == null) {
|
|
|
continue;
|
|
|
}
|
|
|
if (Constants.BYJZ.equals(ms.getChequeType())) {
|
|
|
byjzAmount = byjzAmount.add(ms.getAmount());
|
|
|
- } else if (Constants.YBJZ.equals(ms.getChequeType())) {
|
|
|
+ } else if (Constants.YBJZ.equals(ms.getChequeType())) {
|
|
|
ybjzAmount = ybjzAmount.add(ms.getAmount());
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
notByjzAmount = notByjzAmount.add(ms.getAmount());
|
|
|
}
|
|
|
- if(temp!=null){
|
|
|
+ if (temp != null) {
|
|
|
continue;
|
|
|
}
|
|
|
- temp= CloneUtil.clone(ms);
|
|
|
+ temp = CloneUtil.clone(ms);
|
|
|
temp.setReceiptNo(-temp.getReceiptNo());
|
|
|
//temp.setAmount(BigDecimal.ZERO.subtract(temp.getAmount()));
|
|
|
temp.setReceiptSn(-temp.getReceiptSn());
|
|
@@ -3710,7 +3711,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
temp.setPsordnum(null);
|
|
|
temp.setAgtordnum(null);
|
|
|
temp.setHisrefundnum(null);
|
|
|
- // fullNewMzDepositFiles.add(temp);
|
|
|
+ // fullNewMzDepositFiles.add(temp);
|
|
|
}
|
|
|
//如果有本院记账的退款金额,本院记账记录保持入库
|
|
|
if (byjzAmount.compareTo(BigDecimal.ZERO) == 1) {
|
|
@@ -3769,10 +3770,10 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
byjzNeedPayTemp.setAmount(totalPayable.subtract(notByjzAmount).setScale(1, BigDecimal.ROUND_HALF_UP));
|
|
|
fullNewMzDepositFiles.add(byjzNeedPayTemp);
|
|
|
newMzDepositFiles.add(byjzNeedPayTemp);
|
|
|
- // payWay = Constants.BYJZ;
|
|
|
+ // payWay = Constants.BYJZ;
|
|
|
}
|
|
|
}
|
|
|
- // return payWay;
|
|
|
+ // return payWay;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -4428,6 +4429,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
|
|
|
/**
|
|
|
* 根据已缴费和门诊补录医保信息产生新的退款记录和重收记录
|
|
|
+ *
|
|
|
* @param patientId
|
|
|
* @param times
|
|
|
* @param receiptNo
|
|
@@ -4438,18 +4440,19 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
* @param totalAmount
|
|
|
* @return
|
|
|
*/
|
|
|
- private List<MzDepositFile> getMzDepositFiles(String patientId, Integer times, Integer receiptNo, PayInfo payInfo, Date now, int serialNo, String opId,BigDecimal totalAmount) {
|
|
|
+ private List<MzDepositFile> getMzDepositFiles(String patientId, Integer times, Integer receiptNo, PayInfo payInfo, Date now, int serialNo, String opId, BigDecimal totalAmount) {
|
|
|
List<MzDepositFile> newList = new ArrayList<>();
|
|
|
List<MzDepositFile> mzDepositFiles = mzDepositFileMapper.selectMzDepositFileByTimes(patientId, times, receiptNo, "mz_deposit_file");
|
|
|
//本院记账重收的时候。新的收费方式与老的部分收费方式的receiptNo 不一致,所以加这个逻辑
|
|
|
- BigDecimal tempAmount=mzDepositFileMapper.selectSumAmount(patientId, times, receiptNo);
|
|
|
- if(totalAmount.compareTo(tempAmount)>0){
|
|
|
- mzDepositFiles=mzDepositFileMapper.selectMzDepositFileByTimesWithOutByjz(patientId, times);
|
|
|
+ BigDecimal tempAmount = mzDepositFileMapper.selectSumAmount(patientId, times, receiptNo);
|
|
|
+ if (totalAmount.compareTo(tempAmount) > 0) {
|
|
|
+ mzDepositFiles = mzDepositFileMapper.selectMzDepositFileByTimesWithOutByjz(patientId, times);
|
|
|
}
|
|
|
- MzDepositFile tempMzDepositFile =null;
|
|
|
+ MzDepositFile tempMzDepositFile = null;
|
|
|
+ MzDepositFile cashRefundMzDepositFile = null;
|
|
|
if (mzDepositFiles != null && mzDepositFiles.size() > 0) {
|
|
|
- for (MzDepositFile mf:mzDepositFiles){
|
|
|
- if(tempMzDepositFile==null){
|
|
|
+ for (MzDepositFile mf : mzDepositFiles) {
|
|
|
+ if (tempMzDepositFile == null) {
|
|
|
tempMzDepositFile = CloneUtil.clone(mf);
|
|
|
if (tempMzDepositFile != null) {
|
|
|
tempMzDepositFile.setReceiptNo(receiptNo + 1);
|
|
@@ -4461,6 +4464,10 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
tempMzDepositFile.setOpId(opId);
|
|
|
}
|
|
|
}
|
|
|
+ if (cashRefundMzDepositFile != null && !(Constants.BYJZ.equals(mf.getChequeType()) || Constants.YBJZ.equals(mf.getChequeType()))) {
|
|
|
+ cashRefundMzDepositFile.setAmount(cashRefundMzDepositFile.getAmount().subtract(mf.getAmount()));
|
|
|
+ continue;
|
|
|
+ }
|
|
|
mf.setReceiptNo(0 - mf.getReceiptNo());
|
|
|
mf.setAmount(BigDecimal.ZERO.subtract(mf.getAmount()));
|
|
|
mf.setReceiptSn(0 - mf.getReceiptSn());
|
|
@@ -4470,34 +4477,35 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
mf.setOpId(opId);
|
|
|
mf.setDcountDate(null);
|
|
|
mf.setDcountNo(YesNoEnum.NO.code);
|
|
|
- if(!(Constants.BYJZ.equals(mf.getChequeType()) || Constants.YBJZ.equals(mf.getChequeType()))){
|
|
|
+ if (!(Constants.BYJZ.equals(mf.getChequeType()) || Constants.YBJZ.equals(mf.getChequeType()))) {
|
|
|
mf.setChequeType(Constants.CASH);
|
|
|
+ cashRefundMzDepositFile = mf;
|
|
|
}
|
|
|
newList.add(mf);
|
|
|
}
|
|
|
}
|
|
|
- if(tempMzDepositFile==null){
|
|
|
+ if (tempMzDepositFile == null) {
|
|
|
return newList;
|
|
|
}
|
|
|
- MzDepositFile fundPayDepositFile = CloneUtil.clone(tempMzDepositFile);
|
|
|
+ MzDepositFile fundPayDepositFile = CloneUtil.clone(tempMzDepositFile);
|
|
|
fundPayDepositFile.setChequeType(Constants.YBJZ);
|
|
|
fundPayDepositFile.setAmount(payInfo.getFundPay());
|
|
|
//门诊统筹补录标记
|
|
|
fundPayDepositFile.setChequeNo(YesNoEnum.YES.code.toString());
|
|
|
newList.add(fundPayDepositFile);
|
|
|
- BigDecimal selfAmount =totalAmount.subtract(payInfo.getFundPay());
|
|
|
- if(payInfo.getAcctPay()!=null && payInfo.getAcctPay().compareTo(BigDecimal.ZERO)==1){
|
|
|
- MzDepositFile accDepositFile = CloneUtil.clone(tempMzDepositFile);
|
|
|
+ BigDecimal selfAmount = totalAmount.subtract(payInfo.getFundPay());
|
|
|
+ if (payInfo.getAcctPay() != null && payInfo.getAcctPay().compareTo(BigDecimal.ZERO) == 1) {
|
|
|
+ MzDepositFile accDepositFile = CloneUtil.clone(tempMzDepositFile);
|
|
|
accDepositFile.setChequeType(Integer.valueOf(2).equals(payInfo.getCardType()) ? Constants.SHENYGZ : Constants.SSHIYBGZ);
|
|
|
accDepositFile.setAmount(payInfo.getAcctPay());
|
|
|
//门诊统筹补录标记
|
|
|
accDepositFile.setChequeNo(YesNoEnum.YES.code.toString());
|
|
|
newList.add(accDepositFile);
|
|
|
- selfAmount =selfAmount.subtract(payInfo.getAcctPay());
|
|
|
+ selfAmount = selfAmount.subtract(payInfo.getAcctPay());
|
|
|
}
|
|
|
- selfAmount=selfAmount.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
- if(selfAmount.compareTo(BigDecimal.ZERO)==1) {
|
|
|
- MzDepositFile selfDepositFile = CloneUtil.clone(tempMzDepositFile);
|
|
|
+ selfAmount = selfAmount.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ if (selfAmount.compareTo(BigDecimal.ZERO) == 1) {
|
|
|
+ MzDepositFile selfDepositFile = CloneUtil.clone(tempMzDepositFile);
|
|
|
selfDepositFile.setChequeType(Constants.CASH);
|
|
|
selfDepositFile.setAmount(selfAmount);
|
|
|
newList.add(selfDepositFile);
|
|
@@ -4508,6 +4516,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
|
|
|
/**
|
|
|
* 根据已缴费和门诊补录医保信息产生新的退款记录和重收记录
|
|
|
+ *
|
|
|
* @param opId
|
|
|
* @param patientId
|
|
|
* @param times
|
|
@@ -4518,19 +4527,19 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
* @param totalAmount
|
|
|
* @return
|
|
|
*/
|
|
|
- private List<MzReceiptSerial> getMzReceiptSerials(String opId, String patientId, Integer times, Integer receiptNo,PayInfo payInfo, Date now, int serialNo,BigDecimal totalAmount) {
|
|
|
+ private List<MzReceiptSerial> getMzReceiptSerials(String opId, String patientId, Integer times, Integer receiptNo, PayInfo payInfo, Date now, int serialNo, BigDecimal totalAmount) {
|
|
|
List<MzReceiptSerial> newList = new ArrayList<>();
|
|
|
- List<MzReceiptSerial> mzReceiptSerials = mzReceiptSerialMapper.selectReceiptDetails(patientId,times,receiptNo, "mz_receipt_serial");
|
|
|
+ List<MzReceiptSerial> mzReceiptSerials = mzReceiptSerialMapper.selectReceiptDetails(patientId, times, receiptNo, "mz_receipt_serial");
|
|
|
//本院记账重收的时候。新的收费方式与老的部分收费方式的receiptNo 不一致,所以加这个逻辑
|
|
|
- BigDecimal tempAmount=mzDepositFileMapper.selectSumAmount(patientId, times, receiptNo);
|
|
|
- if(totalAmount.compareTo(tempAmount)>0){
|
|
|
- mzReceiptSerials=mzReceiptSerialMapper.selectReceiptDetailsWithOutByjz(patientId, times);
|
|
|
+ BigDecimal tempAmount = mzDepositFileMapper.selectSumAmount(patientId, times, receiptNo);
|
|
|
+ if (totalAmount.compareTo(tempAmount) > 0) {
|
|
|
+ mzReceiptSerials = mzReceiptSerialMapper.selectReceiptDetailsWithOutByjz(patientId, times);
|
|
|
}
|
|
|
- MzReceiptSerial tempMzReceiptSerial =null;
|
|
|
+ MzReceiptSerial tempMzReceiptSerial = null;
|
|
|
if (mzReceiptSerials != null && mzReceiptSerials.size() > 0) {
|
|
|
- for (MzReceiptSerial ms:mzReceiptSerials){
|
|
|
+ for (MzReceiptSerial ms : mzReceiptSerials) {
|
|
|
if (!Constants.BYJZ.equals(ms.getChequeType()) && !Constants.YBJZ.equals(ms.getChequeType())) {
|
|
|
- tempMzReceiptSerial= CloneUtil.clone(ms);
|
|
|
+ tempMzReceiptSerial = CloneUtil.clone(ms);
|
|
|
if (tempMzReceiptSerial != null) {
|
|
|
tempMzReceiptSerial.setReceiptNo(receiptNo + 1);
|
|
|
tempMzReceiptSerial.setDcountNo(YesNoEnum.NO.code);
|
|
@@ -4585,17 +4594,17 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
newList.add(ms);
|
|
|
}
|
|
|
}
|
|
|
- if(tempMzReceiptSerial==null){
|
|
|
+ if (tempMzReceiptSerial == null) {
|
|
|
return newList;
|
|
|
}
|
|
|
- MzReceiptSerial fundPayMzReceiptSerial= CloneUtil.clone(tempMzReceiptSerial);
|
|
|
+ MzReceiptSerial fundPayMzReceiptSerial = CloneUtil.clone(tempMzReceiptSerial);
|
|
|
fundPayMzReceiptSerial.setChequeType(Constants.YBJZ);
|
|
|
fundPayMzReceiptSerial.setTotalCharge(payInfo.getFundPay());
|
|
|
- if(totalAmount.compareTo(payInfo.getFundPay())>0){
|
|
|
+ if (totalAmount.compareTo(payInfo.getFundPay()) > 0) {
|
|
|
fundPayMzReceiptSerial.resetParams();
|
|
|
}
|
|
|
newList.add(fundPayMzReceiptSerial);
|
|
|
- BigDecimal selfAmount =totalAmount.subtract(payInfo.getFundPay());
|
|
|
+ BigDecimal selfAmount = totalAmount.subtract(payInfo.getFundPay());
|
|
|
tempMzReceiptSerial.setTotalCharge(selfAmount);
|
|
|
newList.add(tempMzReceiptSerial);
|
|
|
return newList;
|