|
@ -9,13 +9,14 @@ import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
import com.yihu.wlyy.entity.organization.HospitalMapping;
|
|
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.ylz.PayConfigura;
|
|
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.organization.HospitalMappingDao;
|
|
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.ylz.PayConfiguraDao;
|
|
import com.yihu.wlyy.service.third.httplog.LogService;
|
|
import com.yihu.wlyy.service.third.httplog.LogService;
|
|
import com.yihu.wlyy.service.weixin.wxpay.common.Configure;
|
|
|
|
import com.yihu.wlyy.service.weixin.wxpay.model.BindCard;
|
|
import com.yihu.wlyy.service.weixin.wxpay.model.BindCard;
|
|
import com.yihu.wlyy.service.weixin.wxpay.model.Charge;
|
|
import com.yihu.wlyy.service.weixin.wxpay.model.Charge;
|
|
import com.yihu.wlyy.util.SystemConf;
|
|
import com.yihu.wlyy.util.SystemConf;
|
|
@ -24,7 +25,6 @@ import com.ylzinfo.onepay.sdk.OnepayDefaultClient;
|
|
import com.ylzinfo.onepay.sdk.domain.RequestParams;
|
|
import com.ylzinfo.onepay.sdk.domain.RequestParams;
|
|
import com.ylzinfo.onepay.sdk.domain.ResponseParams;
|
|
import com.ylzinfo.onepay.sdk.domain.ResponseParams;
|
|
import com.ylzinfo.onepay.sdk.utils.DateUtil;
|
|
import com.ylzinfo.onepay.sdk.utils.DateUtil;
|
|
import io.swagger.models.auth.In;
|
|
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@ -47,7 +47,7 @@ import java.util.*;
|
|
public class OnePayService {
|
|
public class OnePayService {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private Configure config;
|
|
|
|
|
|
private PayConfiguraDao configuraDao;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private LogService logService;
|
|
private LogService logService;
|
|
@ -137,6 +137,7 @@ public class OnePayService {
|
|
String error = "";
|
|
String error = "";
|
|
List<BindCard> result = new ArrayList<BindCard>();
|
|
List<BindCard> result = new ArrayList<BindCard>();
|
|
|
|
|
|
|
|
PayConfigura config = configuraDao.findWorkConfigura();
|
|
String appId = config.getOnepayAppId();
|
|
String appId = config.getOnepayAppId();
|
|
String appSecret = config.getOnepayAppSecret();
|
|
String appSecret = config.getOnepayAppSecret();
|
|
OnepayDefaultClient onepayClient = new OnepayDefaultClient(config.getOnepayApi(), appId, appSecret, signType, encryptType);
|
|
OnepayDefaultClient onepayClient = new OnepayDefaultClient(config.getOnepayApi(), appId, appSecret, signType, encryptType);
|
|
@ -218,6 +219,7 @@ public class OnePayService {
|
|
String result = "";
|
|
String result = "";
|
|
String channel = "WX_MMP"; // 医保支付渠道
|
|
String channel = "WX_MMP"; // 医保支付渠道
|
|
String subject = "家庭医生签约支付"; // 订单名称
|
|
String subject = "家庭医生签约支付"; // 订单名称
|
|
|
|
PayConfigura config = configuraDao.findWorkConfigura();
|
|
|
|
|
|
OnepayDefaultClient onepayClient = new OnepayDefaultClient(config.getOnepayApi(), appId, appSecret, signType, encryptType);
|
|
OnepayDefaultClient onepayClient = new OnepayDefaultClient(config.getOnepayApi(), appId, appSecret, signType, encryptType);
|
|
// 未真正完成支付以前预存储支付信息到wlyy_charge表
|
|
// 未真正完成支付以前预存储支付信息到wlyy_charge表
|
|
@ -326,6 +328,8 @@ public class OnePayService {
|
|
Map<String, String> map = new HashMap<>();
|
|
Map<String, String> map = new HashMap<>();
|
|
map.put("feeType", "04");//家庭医生签约
|
|
map.put("feeType", "04");//家庭医生签约
|
|
map.put("settleType", "03"); //健康账户支付
|
|
map.put("settleType", "03"); //健康账户支付
|
|
|
|
//易联众新增字段v1.3.7
|
|
|
|
map.put("principalCardNo", ssc); //实际签约卡号( 默认为绑卡主体卡号)
|
|
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);
|
|
@ -373,6 +377,7 @@ public class OnePayService {
|
|
String response = "";
|
|
String response = "";
|
|
String error = "";
|
|
String error = "";
|
|
String result = null;
|
|
String result = null;
|
|
|
|
PayConfigura config = configuraDao.findWorkConfigura();
|
|
|
|
|
|
WlyyCharge charge = chargeDao.findByCode(code);
|
|
WlyyCharge charge = chargeDao.findByCode(code);
|
|
HospitalMapping hospitalMapping = hospitalMappingDao.findByCode(charge.getHospital());
|
|
HospitalMapping hospitalMapping = hospitalMappingDao.findByCode(charge.getHospital());
|
|
@ -408,7 +413,109 @@ public class OnePayService {
|
|
|
|
|
|
// result = JSON.toJavaObject(res.getParam(), Charge.class);
|
|
// result = JSON.toJavaObject(res.getParam(), Charge.class);
|
|
result = JSON.toJSONString(res.getParam());
|
|
result = JSON.toJSONString(res.getParam());
|
|
// 返回医保机构体
|
|
|
|
|
|
// 新增保存数据
|
|
|
|
JSONObject request = JSON.parseObject(result);
|
|
|
|
// String tradeStatus = request.getString("tradeStatus");//交易状态
|
|
|
|
String chargeStatus = request.getString("chargeStatus");//交易状态
|
|
|
|
String chargeNo = request.getString("chargeNo");//支付平台流水号
|
|
|
|
String chargeTime = request.getString("chargeTime");//支付平台交易成功时间
|
|
|
|
String outChargeNo = request.getString("outChargeNo");//接入应用业务流水号
|
|
|
|
String outChargeTime = request.getString("outChargeTime");//接入应用时间
|
|
|
|
String medOrgNo = request.getString("medOrgNo");//医疗机构编号
|
|
|
|
String medOrgName = request.getString("medOrgName");//医疗机构名称
|
|
|
|
String billNo = request.getString("billNo");//待结算费用单据号
|
|
|
|
String cardNo = request.getString("cardNo");//医保卡号
|
|
|
|
String totalAmount = request.getString("totalAmount");//交易总金额
|
|
|
|
String insuranceAmount = request.getString("insuranceAmount");//医保支付金额
|
|
|
|
String selfPayAmount = request.getString("selfPayAmount");//自付金额
|
|
|
|
String userId = request.getString("userId");//用户openID
|
|
|
|
String userName = request.getString("userName");//用户名字
|
|
|
|
String idNo = request.getString("idNo");//证件号码
|
|
|
|
String idType = request.getString("idType");//证件类型
|
|
|
|
|
|
|
|
// String appId = request.getString("appId");
|
|
|
|
// String channel = request.getString("channel");//支付方式
|
|
|
|
// String sign = request.getString("sign");
|
|
|
|
// String signType = request.getString("signType");
|
|
|
|
// String timestamp = request.getString("timestamp");
|
|
|
|
|
|
|
|
JSONObject responseContents = request.getJSONObject("responseContent");//医保结构体
|
|
|
|
WlyyCharge prescriptionPay = chargeDao.findByCode(outChargeNo);
|
|
|
|
if (responseContents != null) {
|
|
|
|
String miRegisterNo = responseContents.getString("miRegisterNo");//医保挂号
|
|
|
|
String miCollectDate = responseContents.getString("miCollectDate");//收费日期
|
|
|
|
String miCollectTime = responseContents.getString("miCollectTime");//收费时间
|
|
|
|
String miSettleNo = responseContents.getString("miSettleNo");//医保收费单据号 (医保签约号)
|
|
|
|
String miCollectStatus = responseContents.getString("miCollectStatus");//扣费状态
|
|
|
|
String miRegisterStatus = responseContents.getString("miRegisterStatus");//登记状态
|
|
|
|
String cadresPay = responseContents.getString("cadresPay");//公务员补助
|
|
|
|
String miTotalFee = responseContents.getString("miTotalFee");//本次报销总额
|
|
|
|
String healthCarePay = responseContents.getString("healthCarePay");//保健基金支付
|
|
|
|
String heathPay = responseContents.getString("heathPay");//健康账户支付
|
|
|
|
String accountPay = responseContents.getString("accountPay");//个人账户支付
|
|
|
|
String selfPay = responseContents.getString("selfPay");//个人现金支付
|
|
|
|
String civilPay = responseContents.getString("civilPay");//民政补助金额
|
|
|
|
|
|
|
|
/*String miCollectorName = responseContents.getString("miCollectorName");//收费人姓名
|
|
|
|
String fundPay = responseContents.getString("fundPay");//基金支付
|
|
|
|
String commercePay = responseContents.getString("commercePay");//商业保险支付
|
|
|
|
String familyPay = responseContents.getString("familyPay");//共济账户支付
|
|
|
|
String civilZone = responseContents.getString("civilZone");//民政行政区号
|
|
|
|
String bdrugPay = responseContents.getString("bdrugPay");//乙类支付金额
|
|
|
|
String unlessAmount = responseContents.getString("unlessAmount");//非医保费用
|
|
|
|
String exceedAmount = responseContents.getString("exceedAmount");//超封顶线金额
|
|
|
|
String accountBalance = responseContents.getString("accountBalance");//个人账户余额
|
|
|
|
String healthBalance = responseContents.getString("healthBalance");//健康账户余额*/
|
|
|
|
|
|
|
|
prescriptionPay.setMiRegisterNo(miRegisterNo);//医保挂号
|
|
|
|
/*prescriptionPay.setMiSettleNo(miSettleNo);//医保收费单据号
|
|
|
|
|
|
|
|
SimpleDateFormat formatDate = new SimpleDateFormat("yyyyMMdd");
|
|
|
|
prescriptionPay.setMiCollectDate(formatDate.parse(miCollectDate));//收费日期
|
|
|
|
SimpleDateFormat formatTime = new SimpleDateFormat("HHmm");
|
|
|
|
prescriptionPay.setMiCollectTime(formatTime.parse(miCollectTime));//收费时间
|
|
|
|
prescriptionPay.setMiCollectorName(miCollectorName);//收费人姓名
|
|
|
|
prescriptionPay.setMiTotalFee(Integer.parseInt(miTotalFee));//本次报销总额
|
|
|
|
prescriptionPay.setSelfPay(Integer.parseInt(selfPay));//个人现金支付
|
|
|
|
prescriptionPay.setAccountPay(Integer.parseInt(accountPay));//个人账户支付
|
|
|
|
prescriptionPay.setHeathPay(Integer.parseInt(heathPay));//健康账户支付
|
|
|
|
prescriptionPay.setCadresPay(Integer.parseInt(cadresPay));//公务员补助
|
|
|
|
prescriptionPay.setFundPay(Integer.parseInt(fundPay));//基金支付
|
|
|
|
prescriptionPay.setHealthCarePay(Integer.parseInt(healthCarePay));//保健基金支付
|
|
|
|
prescriptionPay.setCommercePay(Integer.parseInt(commercePay));//商业保险支付
|
|
|
|
prescriptionPay.setFamilyPay(Integer.parseInt(familyPay));//共济账户支付
|
|
|
|
prescriptionPay.setCivilPay(Integer.parseInt(civilPay));//民政补助金额
|
|
|
|
prescriptionPay.setCivilZone(civilZone);//民政行政区号
|
|
|
|
prescriptionPay.setBdrugPay(Integer.parseInt(bdrugPay));//乙类支付金额
|
|
|
|
prescriptionPay.setUnlessAmount(Integer.parseInt(unlessAmount));//非医保费用
|
|
|
|
prescriptionPay.setExceedAmount(Integer.parseInt(exceedAmount));//超封顶线金额
|
|
|
|
prescriptionPay.setAccountBalance(Integer.parseInt(accountBalance));//个人账户余额
|
|
|
|
prescriptionPay.setHealthBalance(Integer.parseInt(healthBalance));//健康账户余额*/
|
|
|
|
|
|
|
|
}
|
|
|
|
if ("0".equals(chargeStatus) || "SUCCESS".equals(chargeStatus)) {
|
|
|
|
prescriptionPay.setTradeStatus("1");//交易状态 成功1 失败0
|
|
|
|
}else {
|
|
|
|
prescriptionPay.setTradeStatus("0");//交易状态 成功1 失败0
|
|
|
|
}
|
|
|
|
prescriptionPay.setChargeNo(chargeNo);//支付流水号
|
|
|
|
SimpleDateFormat formatDate = new SimpleDateFormat("yyyyMMddHHmmss");
|
|
|
|
prescriptionPay.setChargeTime(chargeTime);//支付平台交易成功时间
|
|
|
|
// prescriptionPay.setOutChargeTime(formatDate.parse(outChargeTime));//接入应用内业务时间
|
|
|
|
prescriptionPay.setMedOrgNo(medOrgNo);//医疗机构编号
|
|
|
|
prescriptionPay.setMedOrgName(medOrgName);//医疗机构名称
|
|
|
|
prescriptionPay.setBillNo(billNo);//待结算费用单据号
|
|
|
|
prescriptionPay.setSsc(cardNo);//医保卡号
|
|
|
|
prescriptionPay.setTotalAmount(Integer.parseInt(totalAmount));//交易总金额
|
|
|
|
prescriptionPay.setInsuranceAmount(Integer.parseInt(insuranceAmount));//医保支付金额
|
|
|
|
prescriptionPay.setSelfpayAmount(Integer.parseInt(selfPayAmount));//自付金额
|
|
|
|
prescriptionPay.setOpenid(userId);
|
|
|
|
prescriptionPay.setName(userName);
|
|
|
|
prescriptionPay.setIdType(idType);//证件类型
|
|
|
|
prescriptionPay.setIdNo(idNo);//证件号码
|
|
|
|
|
|
|
|
// 保存数据库更改记录
|
|
|
|
chargeDao.save(prescriptionPay);
|
|
|
|
|
|
// System.out.println("请求成功,返回参数:" + result.getTradeStatus() + " " + result.getUserName());
|
|
// System.out.println("请求成功,返回参数:" + result.getTradeStatus() + " " + result.getUserName());
|
|
LOGGER.info("请求成功,返回参数: "+result);
|
|
LOGGER.info("请求成功,返回参数: "+result);
|
|
@ -443,6 +550,7 @@ public class OnePayService {
|
|
String response = "";
|
|
String response = "";
|
|
String error = "";
|
|
String error = "";
|
|
String result = "";
|
|
String result = "";
|
|
|
|
PayConfigura config = configuraDao.findWorkConfigura();
|
|
|
|
|
|
String appId = config.getOnepayAppId();
|
|
String appId = config.getOnepayAppId();
|
|
String appSecret = config.getOnepayAppSecret();
|
|
String appSecret = config.getOnepayAppSecret();
|
|
@ -461,6 +569,8 @@ public class OnePayService {
|
|
JSONObject params = new JSONObject();
|
|
JSONObject params = new JSONObject();
|
|
params.put("openId", openid);
|
|
params.put("openId", openid);
|
|
params.put("accId", accId); //微信公众号开发者ID
|
|
params.put("accId", accId); //微信公众号开发者ID
|
|
|
|
// 易联众新增字段代支付v1.3.7
|
|
|
|
params.put("createType", "sicard"); //生成类型 sicard 个人电子社保卡 OR family 家庭成员绑卡 ( 默认 sicard)
|
|
requestParams.setParam(params);
|
|
requestParams.setParam(params);
|
|
requestParams.setTransType(config.getCreateSicardType());
|
|
requestParams.setTransType(config.getCreateSicardType());
|
|
|
|
|