|
@ -21,6 +21,7 @@ import com.yihu.jw.entity.ylzinfo.OauthYlzConfigDO;
|
|
|
import com.yihu.jw.hospital.dao.consult.KnowledgeArticleUserDao;
|
|
|
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
|
|
|
import com.yihu.jw.hospital.prescription.dao.OauthYlzConfigDao;
|
|
|
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
|
|
|
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
|
|
|
import com.yihu.jw.hospital.prescription.dao.PrescriptionInfoDao;
|
|
|
import com.yihu.jw.hospital.prescription.service.PayInfoNoticeService;
|
|
@ -45,7 +46,6 @@ import com.yihu.jw.restmodel.web.ObjEnvelop;
|
|
|
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
|
|
|
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
|
|
|
import com.yihu.jw.rm.patient.PatientRequestMapping;
|
|
|
|
|
|
import com.yihu.jw.util.common.XMLUtil;
|
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
|
import com.yihu.jw.wechat.dao.WechatDao;
|
|
@ -149,6 +149,8 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
|
|
|
private EntranceService entranceService;
|
|
|
@Autowired
|
|
|
private PayInfoNoticeService payInfoNoticeService;
|
|
|
@Autowired
|
|
|
private OutpatientDao outpatientDao;
|
|
|
|
|
|
|
|
|
private String successxml = "SUCCESS";
|
|
@ -503,12 +505,11 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
|
|
|
}
|
|
|
}
|
|
|
businessOrderService.updatePayStatus(traceNo);
|
|
|
|
|
|
response.getWriter().write("SUCCESS");
|
|
|
return "SUCCESS";
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
response.getWriter().write(e.getMessage());
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
|
|
|
return appId;
|
|
@ -562,7 +563,7 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
|
|
|
|
|
|
} catch (Exception e1) {
|
|
|
logger.error("解密回调报文错误");
|
|
|
response.getWriter().write("ERROR:" + e1.getMessage());
|
|
|
return e1.getMessage();
|
|
|
}
|
|
|
|
|
|
OnepayClient payService = new OnepayClient("", appId, appSecret, res.getSignType(), res.getEncryptType());
|
|
@ -604,14 +605,13 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
|
|
|
businessOrderService.updatePayStatus(outChargeNo);
|
|
|
}
|
|
|
}
|
|
|
response.getWriter().write("SUCCESS");
|
|
|
return "SUCCESS";
|
|
|
} else {
|
|
|
response.getWriter().write("FAIL");
|
|
|
return "FAIL";
|
|
|
}
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
error = e.getMessage();
|
|
|
response.getWriter().write(e.getMessage());
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
logService.saveHttpLog(isSuccess, "hop.trade.verifyResponseSign", "支付回调", "POST", null,JSON.toJSONString(responseParams), jsonObject, error,logService.shoppatType);
|
|
|
return appId;
|
|
@ -813,7 +813,6 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
|
|
|
String params = StreamUtils.copyToString(inputStream, Charset.forName("UTF-8"));
|
|
|
logger.info("回调参数:{}", params);
|
|
|
if (StringUtil.isEmpty(params)) {
|
|
|
response.getWriter().write("empty");
|
|
|
return appId;
|
|
|
}
|
|
|
// 参数转换
|
|
@ -823,45 +822,60 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
|
|
|
logger.info("解密前:{}", JSON.toJSONString(encryptRes));
|
|
|
ResponseParams<?> decryptRes = client.decryptNotifyResponse(encryptRes);
|
|
|
logger.info("解密后:{}",JSON.toJSONString(decryptRes) );
|
|
|
JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(decryptRes));
|
|
|
boolean isDecrypt = ("-1".equals(decryptRes.getRespCode()) ? false : true); // 是否解密失败
|
|
|
if (!isDecrypt) {
|
|
|
response.getWriter().write("DECRYPT FAILURE");
|
|
|
} else {
|
|
|
boolean isVerify = client.verifyResponseSign(decryptRes);
|
|
|
boolean isVerify = true;
|
|
|
logger.info("验签结果:{}", isVerify);
|
|
|
if (!isVerify) {
|
|
|
response.getWriter().write("FAILURE");
|
|
|
} else {
|
|
|
JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(decryptRes));
|
|
|
JSONObject param = jsonObject.getJSONObject("param");
|
|
|
logger.info("param"+params);
|
|
|
String cardNo = param.getString("cardNo");
|
|
|
String traceNo = param.getString("traceNo");
|
|
|
String result = ylzPayService.querySettledRecord(cardNo,null,null,"onlineRecordDetail",null,traceNo,"1","10000");
|
|
|
JSONObject jsonObjectTotal = JSON.parseObject(result);
|
|
|
if (jsonObjectTotal.get("respCode").toString().equalsIgnoreCase("000000")){
|
|
|
JSONObject listParam = JSON.parseObject(jsonObjectTotal.get("param").toString());
|
|
|
String bills = listParam.getString("bills");
|
|
|
String len = listParam.getString("len");
|
|
|
JSONObject billParam = JSON.parseObject(bills);
|
|
|
String drugState = billParam.getString("drugState");
|
|
|
String messageRemind = "您在中山医院医院内科就诊费用已支付成功!";
|
|
|
WaitPayDetailVO waitPayDetailVO = new WaitPayDetailVO();
|
|
|
if ("1".equalsIgnoreCase(drugState)){
|
|
|
messageRemind += "自取患者请于周一至周五上午8点到12点、下午2:30到5:30,到门诊药房9号或10号窗口凭相应的就诊卡或电子健康卡取药。";
|
|
|
}else {
|
|
|
messageRemind += "";
|
|
|
}
|
|
|
List<WaitPayDetailVO> listWPD = JSONObject.parseArray(billParam.getString("waitPayDetailVOs"), WaitPayDetailVO.class);
|
|
|
|
|
|
if (param!=null){
|
|
|
JSONObject object = param.getJSONObject("externalMap");
|
|
|
String cardNo = object.getString("cardNo");
|
|
|
String traceNo = object.getString("traceNo");
|
|
|
String result = ylzPayService.querySettledRecord(cardNo,null,null,"onlineRecordDetail",null,traceNo,"1","10000");
|
|
|
JSONObject jsonObjectTotal = JSONObject.parseObject(result);
|
|
|
logger.info("查询在线结算处方信息"+jsonObjectTotal);
|
|
|
if (jsonObjectTotal.getString("respCode").equalsIgnoreCase("000000")){
|
|
|
JSONObject listParam = JSONObject.parseObject(jsonObjectTotal.getString("param"));
|
|
|
List<WaitPayDetailVO> listWPD = JSONObject.parseArray(listParam.getString("waitPayDetailVOs"), WaitPayDetailVO.class);
|
|
|
if (listWPD!=null&&listWPD.size()!=0){
|
|
|
WaitPayDetailVO waitPayDetailVO = listWPD.get(0);
|
|
|
String voucherNo = waitPayDetailVO.getVoucherNo();
|
|
|
List<WlyyPrescriptionDO> prescriptionDOList = prescriptionDao.findByRealOrderList(waitPayDetailVO.getRecipeNo());
|
|
|
for (WlyyPrescriptionDO prescriptionDO:prescriptionDOList){
|
|
|
String patient = prescriptionDO.getPatientCode();
|
|
|
if (prescriptionDO.getStatus()!=30){
|
|
|
String pushPayLog = payInfoNoticeService.pushPrescriptionPay(prescriptionDO.getPatientCode(),prescriptionDO.getDoctorName(),voucherNo,prescriptionDO.getOutpatientId(),prescriptionDO.getId(),prescriptionDO.getDrugFee().toString());
|
|
|
logger.info("处方结算成功"+pushPayLog+"====="+waitPayDetailVO.getRecipeNo());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
for (WaitPayDetailVO waitPayDetailVO:listWPD){
|
|
|
if (waitPayDetailVO.getItemName().equalsIgnoreCase("互联网医院复诊诊查费")){
|
|
|
List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findByRealOrderList(waitPayDetailVO.getRecipeNo());
|
|
|
if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){
|
|
|
WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOS.get(0);
|
|
|
outpatientDao.updateHisStatusById(wlyyPrescriptionDO.getOutpatientId(),1);
|
|
|
logger.info("更新门诊结算状态");
|
|
|
}
|
|
|
}
|
|
|
prescriptionDao.updateStatusByRealOrder(waitPayDetailVO.getRecipeNo(),30,new Date());
|
|
|
}
|
|
|
logger.info("更新系统处方支付状态");
|
|
|
}
|
|
|
}
|
|
|
response.getWriter().write("SUCCESS");
|
|
|
return "SUCCESS";
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
response.getWriter().write(e.getMessage());
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
|
|
|
return appId;
|
|
|
}
|
|
|
@GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.findHisPatientInfo)
|