|
@ -3,17 +3,12 @@ package com.yihu.wlyy.service.app.prescription;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.fasterxml.jackson.databind.JavaType;
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import com.yihu.wlyy.entity.charge.WlyyCharge;
|
|
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
|
|
import com.yihu.wlyy.entity.message.Message;
|
|
import com.yihu.wlyy.entity.message.Message;
|
|
import com.yihu.wlyy.entity.organization.Hospital;
|
|
import com.yihu.wlyy.entity.organization.Hospital;
|
|
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.prescription.*;
|
|
import com.yihu.wlyy.entity.patient.prescription.*;
|
|
import com.yihu.wlyy.entity.ylz.PayConfigura;
|
|
|
|
import com.yihu.wlyy.entity.zydict.ZyPushLog;
|
|
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;
|
|
@ -22,19 +17,19 @@ import com.yihu.wlyy.repository.organization.HospitalDao;
|
|
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.prescription.*;
|
|
|
|
import com.yihu.wlyy.repository.ylz.PayConfiguraDao;
|
|
|
|
|
|
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
|
|
|
|
import com.yihu.wlyy.repository.prescription.PrescriptionExpressageDao;
|
|
|
|
import com.yihu.wlyy.repository.prescription.PrescriptionInfoDao;
|
|
|
|
import com.yihu.wlyy.repository.prescription.PrescriptionPayDao;
|
|
import com.yihu.wlyy.repository.zydict.ZyPushLogDao;
|
|
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;
|
|
|
|
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.service.OnePayService;
|
|
import com.yihu.wlyy.service.weixin.wxpay.service.OnePayService;
|
|
import com.yihu.wlyy.task.PushMsgTask;
|
|
import com.yihu.wlyy.task.PushMsgTask;
|
|
import com.yihu.wlyy.util.MessageType;
|
|
|
|
import com.yihu.wlyy.util.SystemConf;
|
|
import com.yihu.wlyy.util.SystemConf;
|
|
import com.yihu.wlyy.web.wx.OnePayController;
|
|
|
|
import com.ylzinfo.onepay.sdk.OnepayDefaultClient;
|
|
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;
|
|
@ -46,7 +41,6 @@ import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.security.access.method.P;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.util.StreamUtils;
|
|
import org.springframework.util.StreamUtils;
|
|
|
|
|
|
@ -56,7 +50,6 @@ import javax.transaction.Transactional;
|
|
import java.io.InputStream;
|
|
import java.io.InputStream;
|
|
import java.io.PrintWriter;
|
|
import java.io.PrintWriter;
|
|
import java.io.StringWriter;
|
|
import java.io.StringWriter;
|
|
import java.lang.reflect.Method;
|
|
|
|
import java.nio.charset.Charset;
|
|
import java.nio.charset.Charset;
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
@ -83,7 +76,7 @@ public class PatientPrescriptionPayService extends BaseService {
|
|
|
|
|
|
// 引入实例
|
|
// 引入实例
|
|
@Autowired
|
|
@Autowired
|
|
private PayConfiguraDao configuraDao;
|
|
|
|
|
|
private Configure config;
|
|
@Autowired
|
|
@Autowired
|
|
private ObjectMapper objectMapper;
|
|
private ObjectMapper objectMapper;
|
|
@Autowired
|
|
@Autowired
|
|
@ -259,7 +252,6 @@ public class PatientPrescriptionPayService extends BaseService {
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public Map recipeReturnUrl(HttpServletRequest request, HttpServletResponse response, String accessToken) throws Exception {
|
|
public Map recipeReturnUrl(HttpServletRequest request, HttpServletResponse response, String accessToken) throws Exception {
|
|
PayConfigura config = configuraDao.findWorkConfigura();
|
|
|
|
Map resultMap = new HashMap();
|
|
Map resultMap = new HashMap();
|
|
Prescription prescription = null;
|
|
Prescription prescription = null;
|
|
int flag = 0;
|
|
int flag = 0;
|
|
@ -291,37 +283,37 @@ public class PatientPrescriptionPayService extends BaseService {
|
|
String signType = request.getParameter("signType");
|
|
String signType = request.getParameter("signType");
|
|
String timestamp = request.getParameter("timestamp");
|
|
String timestamp = request.getParameter("timestamp");
|
|
String totalAmount = request.getParameter("totalAmount");//交易总金额
|
|
String totalAmount = request.getParameter("totalAmount");//交易总金额
|
|
// String tradeStatus = request.getParameter("tradeStatus");//交易状态
|
|
|
|
String tradeStatus = request.getParameter("chargeStatus");//交易状态
|
|
|
|
|
|
String tradeStatus = request.getParameter("tradeStatus");//交易状态
|
|
String userId = request.getParameter("userId");//用户openID
|
|
String userId = request.getParameter("userId");//用户openID
|
|
String userName = request.getParameter("userName");//用户名字
|
|
String userName = request.getParameter("userName");//用户名字
|
|
|
|
|
|
String result = chargeQuery(outChargeNo, accessToken);//业务出参
|
|
String result = chargeQuery(outChargeNo, accessToken);//业务出参
|
|
org.json.JSONObject param = new org.json.JSONObject(result);
|
|
org.json.JSONObject param = new org.json.JSONObject(result);
|
|
String requestParam = param.getString("responseContent");
|
|
String requestParam = param.getString("responseContent");
|
|
|
|
System.out.println("requestParam:"+requestParam);
|
|
org.json.JSONObject responseContents = new org.json.JSONObject(requestParam);//医保结构体
|
|
org.json.JSONObject responseContents = new org.json.JSONObject(requestParam);//医保结构体
|
|
// 构建请求结构体
|
|
// 构建请求结构体
|
|
msbody.put("appId",appId);
|
|
|
|
msbody.put("billNo",billNo);
|
|
|
|
msbody.put("cardNo",cardNo);
|
|
|
|
msbody.put("channel",channel);
|
|
|
|
msbody.put("chargeNo",chargeNo);
|
|
|
|
msbody.put("chargeTime",chargeTime);
|
|
|
|
msbody.put("idNo",idNo);
|
|
|
|
msbody.put("idType",idType);
|
|
|
|
msbody.put("insuranceAmount",insuranceAmount);
|
|
|
|
msbody.put("outChargeNo",outChargeNo);
|
|
|
|
msbody.put("outChargeTime",outChargeTime);
|
|
|
|
msbody.put("selfPayAmount",selfPayAmount);
|
|
|
|
msbody.put("sign",sign);
|
|
|
|
msbody.put("signType",signType);
|
|
|
|
msbody.put("timestamp",timestamp);
|
|
|
|
msbody.put("totalAmount",totalAmount);
|
|
|
|
msbody.put("tradeStatus",tradeStatus);
|
|
|
|
msbody.put("userId",userId);
|
|
|
|
msbody.put("userName",userName);
|
|
|
|
msbody.put("responseContent",responseContents);
|
|
|
|
|
|
|
|
|
|
msbody.put("appId", appId);
|
|
|
|
msbody.put("billNo", billNo);
|
|
|
|
msbody.put("cardNo", cardNo);
|
|
|
|
msbody.put("channel", channel);
|
|
|
|
msbody.put("chargeNo", chargeNo);
|
|
|
|
msbody.put("chargeTime", chargeTime);
|
|
|
|
msbody.put("idNo", idNo);
|
|
|
|
msbody.put("idType", idType);
|
|
|
|
msbody.put("insuranceAmount", insuranceAmount);
|
|
|
|
msbody.put("outChargeNo", outChargeNo);
|
|
|
|
msbody.put("outChargeTime", outChargeTime);
|
|
|
|
msbody.put("selfPayAmount", selfPayAmount);
|
|
|
|
msbody.put("sign", sign);
|
|
|
|
msbody.put("signType", signType);
|
|
|
|
msbody.put("timestamp", timestamp);
|
|
|
|
msbody.put("totalAmount", totalAmount);
|
|
|
|
msbody.put("tradeStatus", tradeStatus);
|
|
|
|
msbody.put("userId", userId);
|
|
|
|
msbody.put("userName", userName);
|
|
|
|
msbody.put("responseContent", responseContents);
|
|
|
|
System.out.println("recipeReturnUrl responseContents "+responseContents.toString());
|
|
PrescriptionPay prescriptionPay = payDao.findByCode(outChargeNo);
|
|
PrescriptionPay prescriptionPay = payDao.findByCode(outChargeNo);
|
|
if (responseContents != null) {
|
|
if (responseContents != null) {
|
|
String miSettleNo = "";
|
|
String miSettleNo = "";
|
|
@ -501,7 +493,6 @@ public class PatientPrescriptionPayService extends BaseService {
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public String receiveRecipeNotify(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
|
public String receiveRecipeNotify(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
|
PayConfigura config = configuraDao.findWorkConfigura();
|
|
|
|
|
|
|
|
String result = null;
|
|
String result = null;
|
|
Prescription prescription = null;
|
|
Prescription prescription = null;
|
|
@ -807,8 +798,7 @@ public class PatientPrescriptionPayService extends BaseService {
|
|
* 长处方支付,成功则返回支付路径
|
|
* 长处方支付,成功则返回支付路径
|
|
*/
|
|
*/
|
|
@Transactional
|
|
@Transactional
|
|
public Map charge(int type, String addressJson, String orgCode, String prescriptionCode, int totalAmount, String people, String accessToken, String returnUrl,String deliveryTime) throws Exception {
|
|
|
|
PayConfigura config = configuraDao.findWorkConfigura();
|
|
|
|
|
|
public Map charge(int type, String addressJson, String orgCode, String prescriptionCode, int totalAmount, String people, String accessToken, String returnUrl, String deliveryTime) throws Exception {
|
|
|
|
|
|
Map resultMap = new HashMap();
|
|
Map resultMap = new HashMap();
|
|
Prescription prescription = null;
|
|
Prescription prescription = null;
|
|
@ -1120,8 +1110,6 @@ public class PatientPrescriptionPayService extends BaseService {
|
|
Map<String, String> map = new HashMap<>();//请求结构体
|
|
Map<String, String> map = new HashMap<>();//请求结构体
|
|
map.put("feeType", "06");//长处方结算
|
|
map.put("feeType", "06");//长处方结算
|
|
map.put("settleType", "01"); //诊间医保结算
|
|
map.put("settleType", "01"); //诊间医保结算
|
|
// 易联众新增字段代支付v1.3.7
|
|
|
|
map.put("principalCardNo",ssc); //实际结算卡号( 默认为绑卡主体卡号)
|
|
|
|
params.put("requestContent", objectMapper.writeValueAsString(map));// 请求结构体
|
|
params.put("requestContent", objectMapper.writeValueAsString(map));// 请求结构体
|
|
logger.info("================================>" + "Before msBody");
|
|
logger.info("================================>" + "Before msBody");
|
|
requestParams.setParam(params);
|
|
requestParams.setParam(params);
|
|
@ -1136,12 +1124,7 @@ public class PatientPrescriptionPayService extends BaseService {
|
|
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"));
|
|
// 易联众新增字段代支付v1.3.7
|
|
|
|
String traceTime = String.valueOf(json.get("traceTime"));
|
|
|
|
String traceNo = String.valueOf(json.get("traceNo"));
|
|
|
|
prescriptionPay.setChargeNo(chargeNo);//支付后返回的流水号
|
|
prescriptionPay.setChargeNo(chargeNo);//支付后返回的流水号
|
|
prescriptionPay.setTraceTime(formatter.parse(traceTime));//交易成功时间
|
|
|
|
prescriptionPay.setTraceNo(traceNo);//支付平台跟踪号
|
|
|
|
} else {
|
|
} else {
|
|
isSuccess = false;
|
|
isSuccess = false;
|
|
flag = 0;
|
|
flag = 0;
|
|
@ -1184,7 +1167,7 @@ public class PatientPrescriptionPayService extends BaseService {
|
|
log.setType("3");
|
|
log.setType("3");
|
|
zyPushLogDao.save(log);
|
|
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);
|
|
|
|
|
|
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);
|
|
@ -1199,8 +1182,6 @@ public class PatientPrescriptionPayService extends BaseService {
|
|
* 家庭医生签约支付查询
|
|
* 家庭医生签约支付查询
|
|
*/
|
|
*/
|
|
public String chargeQuery(String code, String accessToken) throws Exception {
|
|
public String chargeQuery(String code, String accessToken) throws Exception {
|
|
PayConfigura config = configuraDao.findWorkConfigura();
|
|
|
|
|
|
|
|
int flag = 0;
|
|
int flag = 0;
|
|
Boolean isSuccess = true;
|
|
Boolean isSuccess = true;
|
|
String msgBody = "";
|
|
String msgBody = "";
|
|
@ -1359,7 +1340,7 @@ public class PatientPrescriptionPayService extends BaseService {
|
|
log.setStatus(Integer.toString(flag));
|
|
log.setStatus(Integer.toString(flag));
|
|
log.setType("3");
|
|
log.setType("3");
|
|
zyPushLogDao.save(log);
|
|
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);
|
|
}
|
|
}
|