|
@ -86,21 +86,48 @@ public class OnePayController extends WeixinBaseController {
|
|
|
@ResponseBody
|
|
|
public String bindCard() throws Exception {
|
|
|
try {
|
|
|
String repUid = getRepUID();
|
|
|
JSONObject json = new JSONObject();
|
|
|
String msg = null;
|
|
|
String uid = getUID();
|
|
|
String openid = getOpenid();
|
|
|
String repUid = getRepUID();
|
|
|
|
|
|
String patient = uid;
|
|
|
Patient people = patientDao.findByCode(uid);
|
|
|
String ssc = people.getSsc();
|
|
|
String createType = "sicard";
|
|
|
if (!repUid.equals(uid)) {
|
|
|
patient = repUid;
|
|
|
createType = "family";
|
|
|
people = patientDao.findByCode(repUid);
|
|
|
ssc = people.getSsc();
|
|
|
}
|
|
|
Patient people = patientDao.findByCode(patient);
|
|
|
String openid = people.getOpenid();
|
|
|
|
|
|
BindCard bindCard = pay.bindCard(patient, openid);
|
|
|
String sicardUrl = pay.createSicard(patient, openid, createType);
|
|
|
if (bindCard != null) {
|
|
|
// BindCard bindCard = pay.bindCard(patient, openid);
|
|
|
List<BindCard> bindCard = pay.bindCardList(openid);
|
|
|
String sicardUrl = pay.createSicard(uid, openid, createType);
|
|
|
for (BindCard cards : bindCard) {
|
|
|
String attachCardNo = cards.getAttachCardNo();
|
|
|
if (StringUtil.isNotEmpty(attachCardNo) && StringUtil.isNotEmpty(ssc) && ssc.equals(attachCardNo)) {
|
|
|
String attachRelation = cards.getAttachRelation();
|
|
|
String attachIdType = cards.getAttachIdType();
|
|
|
String attachIdNo = cards.getAttachIdNo();
|
|
|
String attachName = cards.getAttachName();
|
|
|
json.put("attachRelation", attachRelation);
|
|
|
json.put("attachCardNo", attachCardNo);
|
|
|
json.put("attachIdType", attachIdType);
|
|
|
json.put("attachIdNo", attachIdNo);
|
|
|
json.put("attachName", attachName);
|
|
|
json.put("bindStatus", "000000");
|
|
|
json.put("sicardUrl", sicardUrl);
|
|
|
msg = "查询绑卡信息成功!";
|
|
|
return write(200, "", "data", json);
|
|
|
} else {
|
|
|
json.put("sicardUrl", sicardUrl);
|
|
|
json.put("bindStatus", "030007");
|
|
|
msg = "生成电子社保卡成功!";
|
|
|
}
|
|
|
}
|
|
|
return write(200, msg, "data", json);
|
|
|
/*if (bindCard != null) {
|
|
|
JSONObject json = new JSONObject(bindCard);
|
|
|
json.put("bindStatus", "000000");
|
|
|
json.put("sicardUrl", sicardUrl);
|
|
@ -111,7 +138,8 @@ public class OnePayController extends WeixinBaseController {
|
|
|
json.put("sicardUrl", sicardUrl);
|
|
|
json.put("bindStatus", "030007");
|
|
|
return write(200, "生成电子社保卡成功!", "data", json);
|
|
|
}
|
|
|
}*/
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return write(-1, "查询电子社保卡失败!");
|
|
@ -139,6 +167,9 @@ public class OnePayController extends WeixinBaseController {
|
|
|
|
|
|
if (StringUtils.isNotEmpty(openId)) {
|
|
|
String settleNo = pay.charge(orgCode, chargeType, chargeRelation, totalAmount, patient, repUid, openId, getAccessToken());
|
|
|
if ("-1".equals(settleNo)){
|
|
|
return write(-1, "附属卡未绑定!");
|
|
|
}
|
|
|
return write(200, "家庭医生签约支付成功!", "data", settleNo);
|
|
|
} else {
|
|
|
return write(-1, "openId为空!");
|