|
@ -33,6 +33,7 @@ import com.yihu.jw.order.dao.ConsultOrderDao;
|
|
import com.yihu.jw.order.pay.wx.WeChatConfig;
|
|
import com.yihu.jw.order.pay.wx.WeChatConfig;
|
|
import com.yihu.jw.order.pay.ylz.YlzPayService;
|
|
import com.yihu.jw.order.pay.ylz.YlzPayService;
|
|
import com.yihu.jw.patient.dao.BasePatientDao;
|
|
import com.yihu.jw.patient.dao.BasePatientDao;
|
|
|
|
import com.yihu.jw.util.common.IdCardUtil;
|
|
import com.yihu.jw.util.common.QrcodeUtil;
|
|
import com.yihu.jw.util.common.QrcodeUtil;
|
|
import com.yihu.jw.util.common.XMLUtil;
|
|
import com.yihu.jw.util.common.XMLUtil;
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
@ -42,6 +43,7 @@ import com.yihu.jw.utils.ByteToInputStream;
|
|
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
|
|
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
|
|
import com.yihu.jw.wechat.dao.WechatDao;
|
|
import com.yihu.jw.wechat.dao.WechatDao;
|
|
import com.yihu.jw.wechat.dao.WxPayLogDao;
|
|
import com.yihu.jw.wechat.dao.WxPayLogDao;
|
|
|
|
import com.yihu.jw.wechat.enterprise.EnterpriseService;
|
|
import com.yihu.mysql.query.BaseJpaService;
|
|
import com.yihu.mysql.query.BaseJpaService;
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@ -108,6 +110,11 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
|
|
private XzzxEntranceService xzzxEntranceService;
|
|
private XzzxEntranceService xzzxEntranceService;
|
|
@Value("${wechat.flag}")
|
|
@Value("${wechat.flag}")
|
|
private boolean flag;
|
|
private boolean flag;
|
|
|
|
@Value("${wechat.id}")
|
|
|
|
private String wechatId;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
private EnterpriseService enterpriseService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -430,12 +437,18 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
|
|
if (tradeType.equalsIgnoreCase("JSAPI")){
|
|
if (tradeType.equalsIgnoreCase("JSAPI")){
|
|
map.put("openid", openId);
|
|
map.put("openid", openId);
|
|
}
|
|
}
|
|
|
|
String wapUrl = "";
|
|
|
|
String wapName = "";
|
|
|
|
if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
|
|
|
|
wapUrl = "https://www1.yanketong.com";
|
|
|
|
wapName = "厦门大学附中厦门眼科中心";
|
|
|
|
}
|
|
if (tradeType.equalsIgnoreCase("MWEB")){
|
|
if (tradeType.equalsIgnoreCase("MWEB")){
|
|
JSONObject jsonObject = new JSONObject();
|
|
JSONObject jsonObject = new JSONObject();
|
|
JSONObject object = new JSONObject();
|
|
JSONObject object = new JSONObject();
|
|
object.put("type","Wap");
|
|
object.put("type","Wap");
|
|
object.put("wap_url","");
|
|
|
|
object.put("wap_name","");
|
|
|
|
|
|
object.put("wap_url",wapUrl);
|
|
|
|
object.put("wap_name",wapName);
|
|
jsonObject.put("h5_info",object);
|
|
jsonObject.put("h5_info",object);
|
|
map.put("scene_info",jsonObject.toJSONString());
|
|
map.put("scene_info",jsonObject.toJSONString());
|
|
}
|
|
}
|
|
@ -462,30 +475,58 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
|
|
String mchId = pay.get("mch_id").toString();
|
|
String mchId = pay.get("mch_id").toString();
|
|
String nonceStr = pay.get("nonce_str").toString();
|
|
String nonceStr = pay.get("nonce_str").toString();
|
|
String prepayId = pay.get("prepay_id").toString();
|
|
String prepayId = pay.get("prepay_id").toString();
|
|
String trade = pay.get("trade_type").toString();
|
|
|
|
if (trade.equalsIgnoreCase("Native")){
|
|
|
|
|
|
String trade = "";
|
|
|
|
if ("SUCCESS".equalsIgnoreCase(resultCode)){
|
|
|
|
trade = pay.get("trade_type").toString();
|
|
|
|
if (trade.equalsIgnoreCase("Native")){
|
|
|
|
Map<String,String> param = new HashedMap();
|
|
|
|
param.put("appId",appid);
|
|
|
|
param.put("package","prepay_id="+prepayId);
|
|
|
|
param.put("nonceStr",nonceStr);
|
|
|
|
param.put("signType","MD5");
|
|
|
|
param.put("timeStamp",getTimeStamp());
|
|
|
|
param = WeiXinPayUtils.getMapAfterUnifiedorder(param,wxWechatDO.getAppKey());
|
|
|
|
InputStream qrcode = QrcodeUtil.createQrcode(pay.get("code_url").toString(),300,"jpg");
|
|
|
|
ByteToInputStream byteToInputStream = new ByteToInputStream();
|
|
|
|
String QRCodeImg = byteToInputStream.getBase64FromInputStream(qrcode);
|
|
|
|
param.put("qrcode","data:image/png;base64,"+ QRCodeImg);
|
|
|
|
pay.put("native",param);
|
|
|
|
}//h5支付方法 返回跳转的微信收银台地址
|
|
|
|
else if("MWEB".equalsIgnoreCase(trade)){
|
|
|
|
Map<String,String> param = new HashedMap();
|
|
|
|
param.put("appId",appid);
|
|
|
|
param.put("package","prepay_id="+prepayId);
|
|
|
|
param.put("nonceStr",nonceStr);
|
|
|
|
param.put("signType","MD5");
|
|
|
|
param.put("timeStamp",getTimeStamp());
|
|
|
|
param = WeiXinPayUtils.getMapAfterUnifiedorder(param,wxWechatDO.getAppKey());
|
|
|
|
//微信收银台地址
|
|
|
|
String mwebUrl = pay.get("mweb_url").toString();
|
|
|
|
param.put("mweb_url",mwebUrl);
|
|
|
|
pay.put("MWEB",param);
|
|
|
|
}else {
|
|
|
|
Map<String,String> param = new HashedMap();
|
|
|
|
param.put("appId",appid);
|
|
|
|
param.put("package","prepay_id="+prepayId);
|
|
|
|
param.put("nonceStr",nonceStr);
|
|
|
|
param.put("signType","MD5");
|
|
|
|
param.put("timeStamp",getTimeStamp());
|
|
|
|
param = WeiXinPayUtils.getMapAfterUnifiedorder(param,wxWechatDO.getAppKey());
|
|
|
|
pay.put("jsapi",param);
|
|
|
|
}
|
|
|
|
}else {
|
|
|
|
//支付失败返回信息
|
|
Map<String,String> param = new HashedMap();
|
|
Map<String,String> param = new HashedMap();
|
|
param.put("appId",appid);
|
|
|
|
param.put("package","prepay_id="+prepayId);
|
|
|
|
param.put("nonceStr",nonceStr);
|
|
|
|
param.put("signType","MD5");
|
|
|
|
param.put("timeStamp",getTimeStamp());
|
|
|
|
param = WeiXinPayUtils.getMapAfterUnifiedorder(param,wxWechatDO.getAppKey());
|
|
|
|
InputStream qrcode = QrcodeUtil.createQrcode(pay.get("code_url").toString(),300,"jpg");
|
|
|
|
ByteToInputStream byteToInputStream = new ByteToInputStream();
|
|
|
|
String QRCodeImg = byteToInputStream.getBase64FromInputStream(qrcode);
|
|
|
|
param.put("qrcode","data:image/png;base64,"+ QRCodeImg);
|
|
|
|
pay.put("native",param);
|
|
|
|
|
|
|
|
|
|
param.put("err_code",pay.get("err_code").toString());
|
|
|
|
param.put("err_code_des",pay.get("err_code_des").toString());
|
|
|
|
pay.put("payFailed",param);
|
|
}
|
|
}
|
|
|
|
}else {
|
|
|
|
//通信失败返回信息
|
|
Map<String,String> param = new HashedMap();
|
|
Map<String,String> param = new HashedMap();
|
|
param.put("appId",appid);
|
|
|
|
param.put("package","prepay_id="+prepayId);
|
|
|
|
param.put("nonceStr",nonceStr);
|
|
|
|
param.put("signType","MD5");
|
|
|
|
param.put("timeStamp",getTimeStamp());
|
|
|
|
param = WeiXinPayUtils.getMapAfterUnifiedorder(param,wxWechatDO.getAppKey());
|
|
|
|
pay.put("jsapi",param);
|
|
|
|
|
|
param.put("return_code",pay.get("return_code").toString());
|
|
|
|
param.put("return_msg",pay.get("return_msg").toString());
|
|
|
|
pay.put("connectFailed",param);
|
|
}
|
|
}
|
|
return pay;
|
|
return pay;
|
|
}
|
|
}
|
|
@ -992,7 +1033,32 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
|
|
}else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("2")||businessOrderDO.getOrderCategory().equalsIgnoreCase("3")){
|
|
}else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("2")||businessOrderDO.getOrderCategory().equalsIgnoreCase("3")){
|
|
WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(businessOrderDO.getRelationCode());
|
|
WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(businessOrderDO.getRelationCode());
|
|
wlyyOutpatientDO.setPayStatus(1);
|
|
wlyyOutpatientDO.setPayStatus(1);
|
|
outpatientDao.save(wlyyOutpatientDO);
|
|
|
|
|
|
WlyyOutpatientDO outpatientDO = outpatientDao.save(wlyyOutpatientDO);
|
|
|
|
//发送企业模板消息给医生
|
|
|
|
BasePatientDO patientDO = new BasePatientDO();
|
|
|
|
String msg = "";
|
|
|
|
String name=outpatientDO.getPatientName();
|
|
|
|
String sex = "";
|
|
|
|
String age="";
|
|
|
|
String date = "";
|
|
|
|
String title = "";
|
|
|
|
String url="https://hlwyy.xmzsh.com/hlwyy/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
|
|
|
|
if (patientDO!=null){
|
|
|
|
sex= IdCardUtil.getSexForIdcard(patientDO.getIdcard());
|
|
|
|
age = IdCardUtil.getAgeForIdcard(patientDO.getIdcard())+"";
|
|
|
|
}
|
|
|
|
if (outpatientDO!=null){
|
|
|
|
if (outpatientDO.getType().equalsIgnoreCase("1")){
|
|
|
|
title = "图文复诊";
|
|
|
|
msg = name+"("+sex+" "+age+"岁)向您发起了图文复诊,点击查看";
|
|
|
|
}else if (outpatientDO.getType().equalsIgnoreCase("2")){
|
|
|
|
title = "视频复诊";
|
|
|
|
date = DateUtil.dateToStrLong(outpatientDO.getRegisterDate());
|
|
|
|
msg = name+"("+sex+" "+age+"岁)预约了"+date+"的视频复诊,点击查看";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
enterpriseService.sendTWMesByDoctor("zsyy",outpatientDO.getDoctor(),title,msg,url);
|
|
|
|
System.out.println("发送企业模板消息成功");
|
|
} else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("4")) {
|
|
} else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("4")) {
|
|
List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findById(businessOrderDO.getRelationCode());
|
|
List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findById(businessOrderDO.getRelationCode());
|
|
if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){
|
|
if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){
|
|
@ -1027,7 +1093,32 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
|
|
}else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("2")){
|
|
}else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("2")){
|
|
WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(businessOrderDO.getRelationCode());
|
|
WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(businessOrderDO.getRelationCode());
|
|
wlyyOutpatientDO.setPayStatus(1);
|
|
wlyyOutpatientDO.setPayStatus(1);
|
|
outpatientDao.save(wlyyOutpatientDO);
|
|
|
|
|
|
WlyyOutpatientDO outpatientDO = outpatientDao.save(wlyyOutpatientDO);
|
|
|
|
//发送企业模板消息给医生
|
|
|
|
BasePatientDO patientDO = new BasePatientDO();
|
|
|
|
String msg = "";
|
|
|
|
String name=outpatientDO.getPatientName();
|
|
|
|
String sex = "";
|
|
|
|
String age="";
|
|
|
|
String date = "";
|
|
|
|
String title = "";
|
|
|
|
String url="https://hlwyy.xmzsh.com/hlwyy/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
|
|
|
|
if (patientDO!=null){
|
|
|
|
sex= IdCardUtil.getSexForIdcard(patientDO.getIdcard());
|
|
|
|
age = IdCardUtil.getAgeForIdcard(patientDO.getIdcard())+"";
|
|
|
|
}
|
|
|
|
if (outpatientDO!=null){
|
|
|
|
if (outpatientDO.getType().equalsIgnoreCase("1")){
|
|
|
|
title = "图文复诊";
|
|
|
|
msg = name+"("+sex+" "+age+"岁)向您发起了图文复诊,点击查看";
|
|
|
|
}else if (outpatientDO.getType().equalsIgnoreCase("2")){
|
|
|
|
title = "视频复诊";
|
|
|
|
date = DateUtil.dateToStrLong(outpatientDO.getRegisterDate());
|
|
|
|
msg = name+"("+sex+" "+age+"岁)预约了"+date+"的视频复诊,点击查看";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
enterpriseService.sendTWMesByDoctor("zsyy",outpatientDO.getDoctor(),title,msg,url);
|
|
|
|
System.out.println("发送企业模板消息成功");
|
|
} else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("4")) {
|
|
} else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("4")) {
|
|
List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findById(businessOrderDO.getRelationCode());
|
|
List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findById(businessOrderDO.getRelationCode());
|
|
if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){
|
|
if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){
|