|
@ -179,20 +179,22 @@ public class OnePayService {
|
|
/**
|
|
/**
|
|
* 家庭医生签约支付
|
|
* 家庭医生签约支付
|
|
*/
|
|
*/
|
|
public String charge(String orgCode, String chargeType, String chargeRelation, Integer totalAmount, String feeDetail, String patient, String openid,String accessToken) throws Exception {
|
|
|
|
|
|
public String charge(String orgCode, String chargeType, String chargeRelation, Integer totalAmount, String patient, String openid,String accessToken) throws Exception {
|
|
//获取机构映射
|
|
//获取机构映射
|
|
HospitalMapping hos = hospitalMappingDao.findByCode(orgCode);
|
|
HospitalMapping hos = hospitalMappingDao.findByCode(orgCode);
|
|
if (hos == null) {
|
|
if (hos == null) {
|
|
throw new Exception("no hospital mapping!");
|
|
throw new Exception("no hospital mapping!");
|
|
}
|
|
}
|
|
|
|
|
|
return charge(orgCode, hos.getName(), hos.getAppId(), hos.getAppSecret(), chargeType, chargeRelation, totalAmount, feeDetail, 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);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 家庭医生签约支付,成功则返回支付路径
|
|
* 家庭医生签约支付,成功则返回支付路径
|
|
*/
|
|
*/
|
|
private String charge(String orgCode, String orgName, String appId, String appSecret, String chargeType, String chargeRelation, Integer totalAmount, String feeDetail, 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, Integer totalAmount,String patient, String openid,String accessToken) throws Exception {
|
|
Boolean isSuccess = true;
|
|
Boolean isSuccess = true;
|
|
String msgBody = "";
|
|
String msgBody = "";
|
|
String response = "";
|
|
String response = "";
|
|
@ -220,10 +222,6 @@ public class OnePayService {
|
|
charge.setMerchName(orgName);
|
|
charge.setMerchName(orgName);
|
|
charge.setSubject(subject);
|
|
charge.setSubject(subject);
|
|
charge.setTotalAmount(totalAmount); // 交易总金额
|
|
charge.setTotalAmount(totalAmount); // 交易总金额
|
|
// charge.setSelfpayAmount(selfpayAmount); // 自费金额
|
|
|
|
// charge.setInsuranceAmount(insuranceAmount); // 医保支付金额
|
|
|
|
// charge.setFinancialAmount(financialAmount); // 财政补贴金额
|
|
|
|
charge.setFeeDetail(feeDetail); // 费用明细
|
|
|
|
|
|
|
|
BindCard card = ownerCard(openid);
|
|
BindCard card = ownerCard(openid);
|
|
String name = card.getAttachName();
|
|
String name = card.getAttachName();
|
|
@ -260,14 +258,10 @@ public class OnePayService {
|
|
params.put("idType", idType);
|
|
params.put("idType", idType);
|
|
params.put("idNo", idNo);
|
|
params.put("idNo", idNo);
|
|
params.put("totalAmount", totalAmount); //交易总金额
|
|
params.put("totalAmount", totalAmount); //交易总金额
|
|
// params.put("selfpayAmount",selfpayAmount); //自费金额
|
|
|
|
// params.put("insuranceAmount",insuranceAmount); //医保支付金额
|
|
|
|
// params.put("financialAmount",financialAmount); //财政补贴金额
|
|
|
|
// params.put("returnUrl","https://mp.weixin.qq.com/insurance/pay/detail"); //页面跳转地址
|
|
|
|
Properties systemConf = SystemConf.getInstance().getSystemProperties();
|
|
Properties systemConf = SystemConf.getInstance().getSystemProperties();
|
|
String returnUrl = systemConf.getProperty("return_url");
|
|
String returnUrl = systemConf.getProperty("return_url");
|
|
|
|
returnUrl = returnUrl.replace("{server}", systemConf.getProperty("server_url"));
|
|
params.put("returnUrl",returnUrl); //页面跳转地址
|
|
params.put("returnUrl",returnUrl); //页面跳转地址
|
|
params.put("feeDetail", feeDetail); //费用明细
|
|
|
|
params.put("channel", channel); //微信医保支付
|
|
params.put("channel", channel); //微信医保支付
|
|
params.put("merchName", orgName); //收款单位名称
|
|
params.put("merchName", orgName); //收款单位名称
|
|
params.put("subject", subject); //订单名称
|
|
params.put("subject", subject); //订单名称
|
|
@ -282,35 +276,37 @@ public class OnePayService {
|
|
// //签约人Code
|
|
// //签约人Code
|
|
String signDoctorCode = signFamily.getSignDoctorCode();
|
|
String signDoctorCode = signFamily.getSignDoctorCode();
|
|
String people = signFamily.getPatient();
|
|
String people = signFamily.getPatient();
|
|
// Doctor doctor = doctorDao.findByCode(signDoctorCode);
|
|
|
|
|
|
|
|
|
|
Doctor doctor = doctorDao.findByCode(signDoctorCode);
|
|
Patient user = patientDao.findByCode(people);
|
|
Patient user = patientDao.findByCode(people);
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
|
Map<String, String> familyContent = new HashMap<>();
|
|
Map<String, String> familyContent = new HashMap<>();
|
|
familyContent.put("moRegNo", chargeRelation);//医院签约号
|
|
|
|
familyContent.put("moRegName",signFamily.getName()); //签约人姓名
|
|
|
|
|
|
familyContent.put("moRegNo", "1481497932");//医院签约号限长20
|
|
|
|
// familyContent.put("moRegName",signFamily.getName()); //签约人姓名
|
|
|
|
familyContent.put("moRegName","林逸祥"); //签约人姓名
|
|
familyContent.put("moRegAddr",user.getAddress() ); //签约人地址
|
|
familyContent.put("moRegAddr",user.getAddress() ); //签约人地址
|
|
familyContent.put("moRegTelephone", signFamily.getMobile());//签约人联系电话
|
|
familyContent.put("moRegTelephone", signFamily.getMobile());//签约人联系电话
|
|
familyContent.put("moRegOrgNo", signFamily.getHospital()); //签约机构
|
|
|
|
familyContent.put("moRegDocNo", signFamily.getSignDoctorCode());//签约医生编号
|
|
|
|
|
|
familyContent.put("moRegOrgNo", sbCode); //签约机构 限长4
|
|
|
|
familyContent.put("moRegDocNo", doctor.getIdcard());//签约医生编号 限长18 身份证号
|
|
familyContent.put("moRegDocName", signFamily.getSignDoctorName()); //签约医生姓名
|
|
familyContent.put("moRegDocName", signFamily.getSignDoctorName()); //签约医生姓名
|
|
familyContent.put("moRegTime", sdf.format(signFamily.getBegin())); //签约时间
|
|
familyContent.put("moRegTime", sdf.format(signFamily.getBegin())); //签约时间
|
|
familyContent.put("moRegEndTime", sdf.format(signFamily.getEnd())); //签约截止时间
|
|
familyContent.put("moRegEndTime", sdf.format(signFamily.getEnd())); //签约截止时间
|
|
// familyContent.put("moRegYear", "04");//签约年度
|
|
// familyContent.put("moRegYear", "04");//签约年度
|
|
familyContent.put("moRegTear", signFamily.getSignYear());//签约年度
|
|
familyContent.put("moRegTear", signFamily.getSignYear());//签约年度
|
|
familyContent.put("moRegSource", signFamily.getSignSource()); //签约来源
|
|
familyContent.put("moRegSource", signFamily.getSignSource()); //签约来源
|
|
familyContent.put("moCollectOrgNo", "03"); //扣费机构
|
|
|
|
familyContent.put("moCollectorNo", "04");//扣费人
|
|
|
|
familyContent.put("benefitType", signFamily.getExpensesType()); //补贴类型
|
|
|
|
familyContent.put("moBookOrgNo", "05");//登记机构
|
|
|
|
familyContent.put("moBookerNo", "06"); //登记人
|
|
|
|
familyContent.put("moBookTime", "07"); //登记时间
|
|
|
|
|
|
familyContent.put("moCollectOrgNo", sbCode); //扣费机构 签约机构
|
|
|
|
familyContent.put("moCollectorNo", signFamily.getSignDoctorName());//扣费人 签约医生姓名
|
|
|
|
familyContent.put("benefitType", signFamily.getExpensesType() ); //补贴类型
|
|
|
|
familyContent.put("moBookOrgNo", sbCode);//登记机构 签约机构
|
|
|
|
familyContent.put("moBookerNo", signFamily.getSignDoctorName()); //登记人 签约医生姓名
|
|
|
|
familyContent.put("moBookTime", sdf.format(signFamily.getBegin())); //登记时间 签约时间
|
|
params.put("familyContent", objectMapper.writeValueAsString(familyContent));// 家庭医生签约信息
|
|
params.put("familyContent", objectMapper.writeValueAsString(familyContent));// 家庭医生签约信息
|
|
}
|
|
}
|
|
//请求结构体
|
|
//请求结构体
|
|
Map<String, String> map = new HashMap<>();
|
|
Map<String, String> map = new HashMap<>();
|
|
map.put("feeType", "04");//家庭医生签约
|
|
map.put("feeType", "04");//家庭医生签约
|
|
map.put("settleType", "02"); //健康账户支付
|
|
|
|
|
|
map.put("settleType", "03"); //健康账户支付
|
|
params.put("requestContent", objectMapper.writeValueAsString(map));// 请求结构体
|
|
params.put("requestContent", objectMapper.writeValueAsString(map));// 请求结构体
|
|
requestParams.setParam(params);
|
|
requestParams.setParam(params);
|
|
msgBody = JSON.toJSONString(requestParams);
|
|
msgBody = JSON.toJSONString(requestParams);
|
|
@ -322,11 +318,9 @@ public class OnePayService {
|
|
JSONObject json = res.getParam();
|
|
JSONObject json = res.getParam();
|
|
String chargeNo = String.valueOf(json.get("chargeNo")); //医保结算业务流水号
|
|
String chargeNo = String.valueOf(json.get("chargeNo")); //医保结算业务流水号
|
|
result = String.valueOf(json.get("payUrl"));
|
|
result = String.valueOf(json.get("payUrl"));
|
|
// charge.setTradeStatus("0");//交易状态0 成功 1 失败 2 已退款
|
|
|
|
charge.setChargeNo(chargeNo);
|
|
charge.setChargeNo(chargeNo);
|
|
|
|
|
|
} else {
|
|
} else {
|
|
// charge.setTradeStatus("1");
|
|
|
|
isSuccess = false;
|
|
isSuccess = false;
|
|
error = "请求失败,返回结果:" + res.getRespCode() + "," + res.getRespMsg();
|
|
error = "请求失败,返回结果:" + res.getRespCode() + "," + res.getRespMsg();
|
|
}
|
|
}
|
|
@ -361,15 +355,21 @@ public class OnePayService {
|
|
String error = "";
|
|
String error = "";
|
|
Charge result = null;
|
|
Charge result = null;
|
|
|
|
|
|
String appId = config.getOnepayAppId();
|
|
|
|
String appSecret = config.getOnepayAppSecret();
|
|
|
|
OnepayDefaultClient onepayClient = new OnepayDefaultClient(config.getOnepayApi(), appId, appSecret, signType, encryptType);
|
|
|
|
|
|
// 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);
|
|
try {
|
|
try {
|
|
RequestParams requestParams = new RequestParams();
|
|
RequestParams requestParams = new RequestParams();
|
|
// requestParams.setVersion();
|
|
// requestParams.setVersion();
|
|
// requestParams.setSign();
|
|
// requestParams.setSign();
|
|
// requestParams.setEncryptData();
|
|
// requestParams.setEncryptData();
|
|
requestParams.setAppId(appId);
|
|
|
|
|
|
// requestParams.setAppId(appId);
|
|
|
|
// requestParams.setAppId(hospitalMapping.getAppId());
|
|
|
|
requestParams.setAppId("54BBAF5148521AC9E053F000660AC501");
|
|
requestParams.setTimestamp(DateUtil.getCurrentDateTime());
|
|
requestParams.setTimestamp(DateUtil.getCurrentDateTime());
|
|
requestParams.setSignType(signType);
|
|
requestParams.setSignType(signType);
|
|
requestParams.setEncryptType(encryptType);
|
|
requestParams.setEncryptType(encryptType);
|