|
@ -13,6 +13,7 @@ import com.yihu.wlyy.entity.organization.HospitalMapping;
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
import com.yihu.wlyy.entity.patient.SignFamily;
|
|
import com.yihu.wlyy.entity.patient.SignFamily;
|
|
import com.yihu.wlyy.entity.patient.prescription.*;
|
|
import com.yihu.wlyy.entity.patient.prescription.*;
|
|
|
|
import com.yihu.wlyy.entity.zydict.ZyPushLog;
|
|
import com.yihu.wlyy.repository.charge.ChargeDao;
|
|
import com.yihu.wlyy.repository.charge.ChargeDao;
|
|
import com.yihu.wlyy.repository.doctor.DoctorDao;
|
|
import com.yihu.wlyy.repository.doctor.DoctorDao;
|
|
import com.yihu.wlyy.repository.message.MessageDao;
|
|
import com.yihu.wlyy.repository.message.MessageDao;
|
|
@ -21,6 +22,7 @@ import com.yihu.wlyy.repository.organization.HospitalMappingDao;
|
|
import com.yihu.wlyy.repository.patient.PatientDao;
|
|
import com.yihu.wlyy.repository.patient.PatientDao;
|
|
import com.yihu.wlyy.repository.patient.SignFamilyDao;
|
|
import com.yihu.wlyy.repository.patient.SignFamilyDao;
|
|
import com.yihu.wlyy.repository.prescription.*;
|
|
import com.yihu.wlyy.repository.prescription.*;
|
|
|
|
import com.yihu.wlyy.repository.zydict.ZyPushLogDao;
|
|
import com.yihu.wlyy.service.BaseService;
|
|
import com.yihu.wlyy.service.BaseService;
|
|
import com.yihu.wlyy.service.third.httplog.LogService;
|
|
import com.yihu.wlyy.service.third.httplog.LogService;
|
|
import com.yihu.wlyy.service.third.jw.JwPrescriptionService;
|
|
import com.yihu.wlyy.service.third.jw.JwPrescriptionService;
|
|
@ -122,6 +124,8 @@ public class PatientPrescriptionPayService extends BaseService {
|
|
private PushMsgTask pushMsgTask;
|
|
private PushMsgTask pushMsgTask;
|
|
@Autowired
|
|
@Autowired
|
|
private JwPrescriptionService jwPrescriptionService;
|
|
private JwPrescriptionService jwPrescriptionService;
|
|
|
|
@Autowired
|
|
|
|
private ZyPushLogDao zyPushLogDao;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 长处方配送信息查询接口
|
|
* 长处方配送信息查询接口
|
|
@ -322,6 +326,7 @@ public class PatientPrescriptionPayService extends BaseService {
|
|
String healthBalance = responseContents.getString("healthBalance");//健康账户余额
|
|
String healthBalance = responseContents.getString("healthBalance");//健康账户余额
|
|
|
|
|
|
prescriptionPay.setBillNo(billNo);//待结算费用单据号
|
|
prescriptionPay.setBillNo(billNo);//待结算费用单据号
|
|
|
|
prescriptionPay.setChargeNo(chargeNo);//支付流水号
|
|
prescriptionPay.setInsuranceAmount(Integer.parseInt(insuranceAmount));//医保支付金额
|
|
prescriptionPay.setInsuranceAmount(Integer.parseInt(insuranceAmount));//医保支付金额
|
|
prescriptionPay.setSelfPayAmount(Integer.parseInt(selfPayAmount));//自付金额
|
|
prescriptionPay.setSelfPayAmount(Integer.parseInt(selfPayAmount));//自付金额
|
|
prescriptionPay.setMiSettleNo(miSettleNo);//医保收费单据号
|
|
prescriptionPay.setMiSettleNo(miSettleNo);//医保收费单据号
|
|
@ -376,8 +381,25 @@ public class PatientPrescriptionPayService extends BaseService {
|
|
response.getWriter().write(e.getMessage());
|
|
response.getWriter().write(e.getMessage());
|
|
}
|
|
}
|
|
// 记录log日志到数据库
|
|
// 记录log日志到数据库
|
|
logService.saveHttpLog(isSuccess, config.getRecipeReturnUrl(), "长处方支付页面跳转", "POST", null, "", responses, error, logService.onepayType);
|
|
|
|
|
|
LOGGER.info("api - "+config.getRecipeReturnUrl());
|
|
|
|
LOGGER.info("request - "+request.toString());
|
|
|
|
LOGGER.info("responses - "+responses);
|
|
|
|
LOGGER.info("error - "+error);
|
|
|
|
|
|
|
|
ZyPushLog log = new ZyPushLog();
|
|
|
|
log.setCreateTime(new Date());
|
|
|
|
log.setApi(config.getRecipeReturnUrl());
|
|
|
|
log.setContent("长处方支付页面跳转");
|
|
|
|
log.setError(error);
|
|
|
|
log.setMethod("POST");
|
|
|
|
log.setRequest(request.toString());
|
|
|
|
log.setResponse(responses);
|
|
|
|
log.setRetryTimes(0);
|
|
|
|
log.setStatus(Integer.toString(flag));
|
|
|
|
log.setType("3");
|
|
|
|
zyPushLogDao.save(log);
|
|
//记录支付log日志到数据库 支付
|
|
//记录支付log日志到数据库 支付
|
|
|
|
logService.saveHttpLog(isSuccess, config.getRecipeReturnUrl(), "长处方支付页面跳转", "POST", null, "", responses, error, logService.onepayType);
|
|
payLogService.addLog(prescription, PrescriptionLog.PrescriptionLogType.pay.getValue(), flag, 1);
|
|
payLogService.addLog(prescription, PrescriptionLog.PrescriptionLogType.pay.getValue(), flag, 1);
|
|
return resultMap;
|
|
return resultMap;
|
|
}
|
|
}
|
|
@ -387,8 +409,9 @@ public class PatientPrescriptionPayService extends BaseService {
|
|
*
|
|
*
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public void receiveRecipeNotify(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
|
|
|
|
|
public String receiveRecipeNotify(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
|
|
|
|
|
|
|
String result = null;
|
|
Prescription prescription = null;
|
|
Prescription prescription = null;
|
|
Boolean isSuccess = false;
|
|
Boolean isSuccess = false;
|
|
int flag = 0;
|
|
int flag = 0;
|
|
@ -406,7 +429,7 @@ public class PatientPrescriptionPayService extends BaseService {
|
|
LOGGER.info("回调参数:{}", params);
|
|
LOGGER.info("回调参数:{}", params);
|
|
if (StringUtil.isEmpty(params)) {
|
|
if (StringUtil.isEmpty(params)) {
|
|
response.getWriter().write("empty");
|
|
response.getWriter().write("empty");
|
|
return;
|
|
|
|
|
|
return null;
|
|
}
|
|
}
|
|
// 参数转换
|
|
// 参数转换
|
|
ResponseParams<?> encryptRes = JSON.parseObject(params, ResponseParams.class);
|
|
ResponseParams<?> encryptRes = JSON.parseObject(params, ResponseParams.class);
|
|
@ -492,6 +515,7 @@ public class PatientPrescriptionPayService extends BaseService {
|
|
//更新数据
|
|
//更新数据
|
|
PrescriptionPay prescriptionPay = payDao.findByCode(outChargeNo);
|
|
PrescriptionPay prescriptionPay = payDao.findByCode(outChargeNo);
|
|
prescriptionPay.setBillNo(billNo);//待结算费用单据号
|
|
prescriptionPay.setBillNo(billNo);//待结算费用单据号
|
|
|
|
prescriptionPay.setChargeNo(chargeNo);//支付流水号
|
|
prescriptionPay.setInsuranceAmount(Integer.parseInt(insuranceAmount));//医保支付金额
|
|
prescriptionPay.setInsuranceAmount(Integer.parseInt(insuranceAmount));//医保支付金额
|
|
prescriptionPay.setSelfPayAmount(Integer.parseInt(selfPayAmount));//自付金额
|
|
prescriptionPay.setSelfPayAmount(Integer.parseInt(selfPayAmount));//自付金额
|
|
prescriptionPay.setMiSettleNo(miSettleNo);//医保收费单据号
|
|
prescriptionPay.setMiSettleNo(miSettleNo);//医保收费单据号
|
|
@ -544,11 +568,12 @@ public class PatientPrescriptionPayService extends BaseService {
|
|
messageDao.save(message);
|
|
messageDao.save(message);
|
|
}
|
|
}
|
|
//支付成功发起结算
|
|
//支付成功发起结算
|
|
try {
|
|
|
|
jwPrescriptionService.executeSickSettle(prescriptionCode);
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
|
|
result = prescriptionCode;
|
|
|
|
// try {
|
|
|
|
// jwPrescriptionService.executeSickSettle(prescriptionCode);
|
|
|
|
// } catch (Exception e) {
|
|
|
|
// e.printStackTrace();
|
|
|
|
// }
|
|
} else if ("1".equals(tradeStatus) || "FAIL".equals(tradeStatus)) {
|
|
} else if ("1".equals(tradeStatus) || "FAIL".equals(tradeStatus)) {
|
|
prescriptionPay.setTradeStatus("0");//交易状态 成功1 失败0
|
|
prescriptionPay.setTradeStatus("0");//交易状态 成功1 失败0
|
|
prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.pay_error.getValue());////续费状态 30支付成功 21支付失败
|
|
prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.pay_error.getValue());////续费状态 30支付成功 21支付失败
|
|
@ -566,9 +591,27 @@ public class PatientPrescriptionPayService extends BaseService {
|
|
response.getWriter().write(e.getMessage());
|
|
response.getWriter().write(e.getMessage());
|
|
}
|
|
}
|
|
// 记录log日志到数据库
|
|
// 记录log日志到数据库
|
|
logService.saveHttpLog(isSuccess, config.getReceiveRecipeNotify(), "异步支付通知", "POST", null, params, responses, error, logService.onepayType);
|
|
|
|
|
|
LOGGER.info("api - "+config.getReceiveRecipeNotify());
|
|
|
|
LOGGER.info("request - "+params);
|
|
|
|
LOGGER.info("responses - "+responses);
|
|
|
|
LOGGER.info("error - "+error);
|
|
|
|
|
|
|
|
ZyPushLog log = new ZyPushLog();
|
|
|
|
log.setCreateTime(new Date());
|
|
|
|
log.setApi(config.getReceiveRecipeNotify());
|
|
|
|
log.setContent("续方异步支付通知");
|
|
|
|
log.setError(error);
|
|
|
|
log.setMethod("POST");
|
|
|
|
log.setRequest(params);
|
|
|
|
log.setResponse(responses);
|
|
|
|
log.setRetryTimes(0);
|
|
|
|
log.setStatus(Integer.toString(flag));
|
|
|
|
log.setType("3");
|
|
|
|
zyPushLogDao.save(log);
|
|
//记录支付log日志到数据库
|
|
//记录支付log日志到数据库
|
|
|
|
logService.saveHttpLog(isSuccess, config.getReceiveRecipeNotify(), "异步支付通知", "POST", null, params, responses, error, logService.onepayType);
|
|
payLogService.addLog(prescription, PrescriptionLog.PrescriptionLogType.pay.getValue(), flag, 1);
|
|
payLogService.addLog(prescription, PrescriptionLog.PrescriptionLogType.pay.getValue(), flag, 1);
|
|
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
//****************************************** 长处方支付基本工具方法 *******************************************************************************
|
|
//****************************************** 长处方支付基本工具方法 *******************************************************************************
|
|
@ -928,8 +971,25 @@ public class PatientPrescriptionPayService extends BaseService {
|
|
error = sw.toString();
|
|
error = sw.toString();
|
|
}
|
|
}
|
|
//保存http日志
|
|
//保存http日志
|
|
logService.saveHttpLog(isSuccess, config.getRecipeChargeType(), "长处方结算", "POST", null, msgBody, response, error, logService.onepayType);
|
|
|
|
|
|
LOGGER.info("api - "+config.getRecipeChargeType());
|
|
|
|
LOGGER.info("request - "+msgBody);
|
|
|
|
LOGGER.info("responses - "+response);
|
|
|
|
LOGGER.info("error - "+error);
|
|
|
|
|
|
|
|
ZyPushLog log = new ZyPushLog();
|
|
|
|
log.setCreateTime(new Date());
|
|
|
|
log.setApi(config.getRecipeChargeType());
|
|
|
|
log.setContent("长处方结算");
|
|
|
|
log.setError(error);
|
|
|
|
log.setMethod("POST");
|
|
|
|
log.setRequest(msgBody);
|
|
|
|
log.setResponse(response);
|
|
|
|
log.setRetryTimes(0);
|
|
|
|
log.setStatus(Integer.toString(flag));
|
|
|
|
log.setType("3");
|
|
|
|
zyPushLogDao.save(log);
|
|
//保存长处方日志 type=2易联众对接 flag =1成功 flag=0 0失败 userType 1 患者 2医生
|
|
//保存长处方日志 type=2易联众对接 flag =1成功 flag=0 0失败 userType 1 患者 2医生
|
|
|
|
logService.saveHttpLog(isSuccess, config.getRecipeChargeType(), "长处方结算", "POST", null, msgBody, response, error, logService.onepayType);
|
|
payLogService.addLog(prescription, PrescriptionLog.PrescriptionLogType.pay.getValue(), flag, 1);
|
|
payLogService.addLog(prescription, PrescriptionLog.PrescriptionLogType.pay.getValue(), flag, 1);
|
|
if (!isSuccess) {
|
|
if (!isSuccess) {
|
|
throw new Exception(error);
|
|
throw new Exception(error);
|
|
@ -1006,6 +1066,23 @@ public class PatientPrescriptionPayService extends BaseService {
|
|
}
|
|
}
|
|
|
|
|
|
//type = 3易联众接口保存http日志
|
|
//type = 3易联众接口保存http日志
|
|
|
|
LOGGER.info("api - "+config.getChargeQueryType());
|
|
|
|
LOGGER.info("request - "+msgBody);
|
|
|
|
LOGGER.info("responses - "+response);
|
|
|
|
LOGGER.info("error - "+error);
|
|
|
|
|
|
|
|
ZyPushLog log = new ZyPushLog();
|
|
|
|
log.setCreateTime(new Date());
|
|
|
|
log.setApi(config.getChargeQueryType());
|
|
|
|
log.setContent("长处方支付查询");
|
|
|
|
log.setError(error);
|
|
|
|
log.setMethod("POST");
|
|
|
|
log.setRequest(msgBody);
|
|
|
|
log.setResponse(response);
|
|
|
|
log.setRetryTimes(0);
|
|
|
|
log.setStatus(Integer.toString(flag));
|
|
|
|
log.setType("3");
|
|
|
|
zyPushLogDao.save(log);
|
|
logService.saveHttpLog(isSuccess, config.getChargeQueryType(), "长处方支付查询", "POST", null, msgBody, response, error, logService.onepayType);
|
|
logService.saveHttpLog(isSuccess, config.getChargeQueryType(), "长处方支付查询", "POST", null, msgBody, response, error, logService.onepayType);
|
|
if (!isSuccess) {
|
|
if (!isSuccess) {
|
|
throw new Exception(error);
|
|
throw new Exception(error);
|