|
@@ -41,6 +41,7 @@ import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
+import org.springframework.dao.DuplicateKeyException;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Isolation;
|
|
|
import org.springframework.transaction.annotation.Propagation;
|
|
@@ -720,7 +721,19 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
clinic.setTimes(mzDepositFileVo.getTimes());
|
|
|
clinic.setReceiptNo(receiptNo);
|
|
|
clinic.setClinicStatus(ClinicStatusEnum.CHARGED.code);
|
|
|
- clinicMapper.updateClinicByPatientIdAndTimes(clinic);
|
|
|
+ try{
|
|
|
+ clinicMapper.updateClinicByPatientIdAndTimes(clinic);
|
|
|
+ }catch (DuplicateKeyException e){
|
|
|
+ //可能会有同一就诊次数不同缴费次数的数据,老医生系统产生,导致更新的时候索引重复,无法缴费
|
|
|
+ List<Clinic> clinicList=clinicMapper.selectByPatientIdAndTimes(mzDepositFileVo.getPatientId(),mzDepositFileVo.getTimes());
|
|
|
+ if(clinicList!=null && clinicList.size()>0){
|
|
|
+ clinicMapper.deleteById(clinicList.get(0).getId());
|
|
|
+ clinicMapper.updateClinicByPatientIdAndTimes(clinic);
|
|
|
+ }
|
|
|
+ e.printStackTrace();
|
|
|
+ log.error(e.getLocalizedMessage());
|
|
|
+ }
|
|
|
+
|
|
|
//发送缴费成功MQ
|
|
|
orderStatusChangeService.orderStatusChange(mzDepositFileVo.getPatientId() + "_" + mzDepositFileVo.getTimes() + "_" + receiptNo + "," + OrderStatusEnum.SUCCESSFUL_PRESCRIPTION_PAYMENT.code);
|
|
|
return receiptNo;
|