|
@ -189,22 +189,22 @@ public class OnePayService {
|
|
|
/**
|
|
|
* 家庭医生签约支付
|
|
|
*/
|
|
|
public String charge(String orgCode, String chargeType, String chargeRelation, Integer totalAmount, String patient, String openid, String accessToken) throws Exception {
|
|
|
public String charge(String orgCode, String chargeType, String chargeRelation, String totalAmount, String patient, String openid, String accessToken) throws Exception {
|
|
|
//获取机构映射
|
|
|
HospitalMapping hos = hospitalMappingDao.findByCode(orgCode);
|
|
|
if (hos == null) {
|
|
|
throw new Exception("no hospital mapping!");
|
|
|
}
|
|
|
// return charge(orgCode, hos.getName(), hos.getAppId(), hos.getAppSecret(),hos.getSbCode(), chargeType, chargeRelation, totalAmount,patient, openid,accessToken);
|
|
|
return charge(orgCode, hos.getName(), hos.getAppId(), hos.getAppSecret(),hos.getSbCode(), chargeType, chargeRelation, totalAmount,patient, openid,accessToken);
|
|
|
// 对应机构的APPID和appsecret
|
|
|
// return charge(orgCode, hos.getName(), "54BBAF5148521AC9E053F000660AC502", "54BBAF5148531AC9E053F000660AC502",hos.getSbCode(), chargeType, chargeRelation, totalAmount,patient, openid,accessToken);
|
|
|
return charge(orgCode, hos.getName(), "54BBAF5148521AC9E053F000660AC502", "54BBAF5148531AC9E053F000660AC502", "0380", chargeType, chargeRelation, totalAmount, patient, openid, accessToken);
|
|
|
// return charge(orgCode, hos.getName(), "54BBAF5148521AC9E053F000660AC502", "54BBAF5148531AC9E053F000660AC502", "0380", chargeType, chargeRelation, totalAmount, patient, openid, accessToken);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 家庭医生签约支付,成功则返回支付路径
|
|
|
*/
|
|
|
private String charge(String orgCode, String orgName, String appId, String appSecret, String sbCode, String chargeType, String chargeRelation, Integer totalAmount, String patient, String openid, String accessToken) throws Exception {
|
|
|
private String charge(String orgCode, String orgName, String appId, String appSecret, String sbCode, String chargeType, String chargeRelation, String totalAmount, String patient, String openid, String accessToken) throws Exception {
|
|
|
Boolean isSuccess = true;
|
|
|
String msgBody = "";
|
|
|
String response = "";
|
|
@ -231,7 +231,7 @@ public class OnePayService {
|
|
|
charge.setChannel(channel);
|
|
|
charge.setMerchName(orgName);
|
|
|
charge.setSubject(subject);
|
|
|
charge.setTotalAmount(totalAmount); // 交易总金额
|
|
|
charge.setTotalAmount(Integer.parseInt(totalAmount)); // 交易总金额
|
|
|
|
|
|
BindCard card = ownerCard(openid);
|
|
|
String name = card.getAttachName();
|
|
@ -289,12 +289,14 @@ public class OnePayService {
|
|
|
|
|
|
Doctor doctor = doctorDao.findByCode(signDoctorCode);
|
|
|
Patient user = patientDao.findByCode(people);
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
|
|
|
|
|
|
Map<String, String> familyContent = new HashMap<>();
|
|
|
familyContent.put("moRegNo", "1481497932");//医院签约号限长20
|
|
|
// familyContent.put("moRegName",signFamily.getName()); //签约人姓名
|
|
|
familyContent.put("moRegName", "林逸祥"); //签约人姓名
|
|
|
// familyContent.put("moRegNo", chargeRelation);//医院签约号限长20 signFamily code
|
|
|
String moregNo = sdf.format(new Date())+ uuid.substring(0,6);
|
|
|
familyContent.put("moRegNo", moregNo);//医院签约号限长20 signFamily code
|
|
|
familyContent.put("moRegName",signFamily.getName()); //签约人姓名
|
|
|
// familyContent.put("moRegName", "沈在鑫"); //签约人姓名
|
|
|
familyContent.put("moRegAddr", user.getAddress()); //签约人地址
|
|
|
familyContent.put("moRegTelephone", signFamily.getMobile());//签约人联系电话
|
|
|
familyContent.put("moRegOrgNo", sbCode); //签约机构 限长4
|
|
@ -308,6 +310,7 @@ public class OnePayService {
|
|
|
familyContent.put("moCollectOrgNo", sbCode); //扣费机构 签约机构
|
|
|
familyContent.put("moCollectorNo", signFamily.getSignDoctorName());//扣费人 签约医生姓名
|
|
|
familyContent.put("benefitType", signFamily.getExpensesType()); //补贴类型
|
|
|
// familyContent.put("benefitType", "01"); //补贴类型
|
|
|
familyContent.put("moBookOrgNo", sbCode);//登记机构 签约机构
|
|
|
familyContent.put("moBookerNo", signFamily.getSignDoctorName()); //登记人 签约医生姓名
|
|
|
familyContent.put("moBookTime", sdf.format(signFamily.getBegin())); //登记时间 签约时间
|
|
@ -368,18 +371,18 @@ public class OnePayService {
|
|
|
// String appId = config.getOnepayAppId();
|
|
|
// String appSecret = config.getOnepayAppSecret();
|
|
|
// OnepayDefaultClient onepayClient = new OnepayDefaultClient(config.getOnepayApi(), appId, appSecret, signType, encryptType);
|
|
|
// WlyyCharge charge = chargeDao.findByCode(code);
|
|
|
// HospitalMapping hospitalMapping = hospitalMappingDao.findByCode(charge.getHospital());
|
|
|
// OnepayDefaultClient onepayClient = new OnepayDefaultClient(config.getOnepayApi(), hospitalMapping.getAppId(), hospitalMapping.getAppSecret(), signType, encryptType);
|
|
|
OnepayDefaultClient onepayClient = new OnepayDefaultClient(config.getOnepayApi(), "54BBAF5148521AC9E053F000660AC501", "54BBAF5148531AC9E053F000660AC501", signType, encryptType);
|
|
|
WlyyCharge charge = chargeDao.findByCode(code);
|
|
|
HospitalMapping hospitalMapping = hospitalMappingDao.findByCode(charge.getHospital());
|
|
|
OnepayDefaultClient onepayClient = new OnepayDefaultClient(config.getOnepayApi(), hospitalMapping.getAppId(), hospitalMapping.getAppSecret(), signType, encryptType);
|
|
|
// OnepayDefaultClient onepayClient = new OnepayDefaultClient(config.getOnepayApi(), "54BBAF5148521AC9E053F000660AC501", "54BBAF5148531AC9E053F000660AC501", signType, encryptType);
|
|
|
try {
|
|
|
RequestParams requestParams = new RequestParams();
|
|
|
// requestParams.setVersion();
|
|
|
// requestParams.setSign();
|
|
|
// requestParams.setEncryptData();
|
|
|
// requestParams.setAppId(appId);
|
|
|
// requestParams.setAppId(hospitalMapping.getAppId());
|
|
|
requestParams.setAppId("54BBAF5148521AC9E053F000660AC501");
|
|
|
requestParams.setAppId(hospitalMapping.getAppId());
|
|
|
// requestParams.setAppId("54BBAF5148521AC9E053F000660AC501");
|
|
|
requestParams.setTimestamp(DateUtil.getCurrentDateTime());
|
|
|
requestParams.setSignType(signType);
|
|
|
requestParams.setEncryptType(encryptType);
|