|
@ -10,6 +10,7 @@ import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
|
|
import com.yihu.jw.entity.base.dict.DictJobTitleDO;
|
|
import com.yihu.jw.entity.base.dict.DictJobTitleDO;
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
|
|
|
|
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
|
|
import com.yihu.jw.entity.base.wx.WxWechatDO;
|
|
import com.yihu.jw.entity.base.wx.WxWechatDO;
|
|
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDO;
|
|
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDO;
|
|
import com.yihu.jw.entity.hospital.article.KnowledgeArticleUserDO;
|
|
import com.yihu.jw.entity.hospital.article.KnowledgeArticleUserDO;
|
|
@ -49,6 +50,7 @@ import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
|
|
import com.yihu.jw.rm.patient.PatientRequestMapping;
|
|
import com.yihu.jw.rm.patient.PatientRequestMapping;
|
|
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;
|
|
|
|
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.service.WechatInfoService;
|
|
import com.yihu.jw.wechat.service.WechatInfoService;
|
|
import com.ylzinfo.onepay.sdk.OnepayClient;
|
|
import com.ylzinfo.onepay.sdk.OnepayClient;
|
|
@ -64,6 +66,7 @@ import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiParam;
|
|
import io.swagger.annotations.ApiParam;
|
|
import net.sf.json.JSONArray;
|
|
import net.sf.json.JSONArray;
|
|
import org.apache.axis.utils.StringUtils;
|
|
import org.apache.axis.utils.StringUtils;
|
|
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
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;
|
|
@ -164,6 +167,8 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
|
|
private HospitalSystemMessageService hospitalSystemMessageService;
|
|
private HospitalSystemMessageService hospitalSystemMessageService;
|
|
@Autowired
|
|
@Autowired
|
|
private StatisticsEsService statisticsEsService;
|
|
private StatisticsEsService statisticsEsService;
|
|
|
|
@Autowired
|
|
|
|
private BasePatientWechatDao patientWechatDao;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -385,7 +390,7 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
|
|
*/
|
|
*/
|
|
@RequestMapping(value = "/getOpenidByCode", method = {RequestMethod.POST, RequestMethod.GET})
|
|
@RequestMapping(value = "/getOpenidByCode", method = {RequestMethod.POST, RequestMethod.GET})
|
|
@ResponseBody
|
|
@ResponseBody
|
|
public Envelop getOpenidByCode(String code) throws Exception {
|
|
|
|
|
|
public Envelop getOpenidByCode(String code,String patientId) throws Exception {
|
|
//通过redis获取openid, 获取不到,则调用微信接口去取
|
|
//通过redis获取openid, 获取不到,则调用微信接口去取
|
|
String key = wxId+":code";
|
|
String key = wxId+":code";
|
|
String openid = redisTemplate.opsForValue().get(key);
|
|
String openid = redisTemplate.opsForValue().get(key);
|
|
@ -393,6 +398,20 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
|
|
return success(PatientRequestMapping.Wechat.api_success,openid);
|
|
return success(PatientRequestMapping.Wechat.api_success,openid);
|
|
}
|
|
}
|
|
openid = wechatInfoService.getOpenidByCode(code, wxId);
|
|
openid = wechatInfoService.getOpenidByCode(code, wxId);
|
|
|
|
List<BasePatientWechatDo> patientWechatDoList = patientWechatDao.findByWechatIdAndPatientId(wxId,patientId);
|
|
|
|
if (patientWechatDoList!=null&&patientWechatDoList.size()!=0){
|
|
|
|
BasePatientWechatDo patientWechatDo = patientWechatDoList.get(0);
|
|
|
|
patientWechatDo.setOpenid(openid);
|
|
|
|
patientWechatDao.save(patientWechatDo);
|
|
|
|
}else {
|
|
|
|
BasePatientWechatDo patientWechatDo = new BasePatientWechatDo();
|
|
|
|
patientWechatDo.setCreateTime(new Date());
|
|
|
|
patientWechatDo.setOpenid(openid);
|
|
|
|
patientWechatDo.setWechatId(wxId);
|
|
|
|
patientWechatDo.setPatientId(patientId);
|
|
|
|
patientWechatDo.setSaasId("dev");
|
|
|
|
patientWechatDao.save(patientWechatDo);
|
|
|
|
}
|
|
redisTemplate.opsForValue().set(key,openid);
|
|
redisTemplate.opsForValue().set(key,openid);
|
|
redisTemplate.expire(key,10, TimeUnit.SECONDS);
|
|
redisTemplate.expire(key,10, TimeUnit.SECONDS);
|
|
return success(PatientRequestMapping.Wechat.api_success,openid);
|
|
return success(PatientRequestMapping.Wechat.api_success,openid);
|
|
@ -409,7 +428,7 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
|
|
@ResponseBody
|
|
@ResponseBody
|
|
@ApiOperation("微信支付结果通知")
|
|
@ApiOperation("微信支付结果通知")
|
|
@RequestMapping(value = "/notify", method = {RequestMethod.GET, RequestMethod.POST})
|
|
@RequestMapping(value = "/notify", method = {RequestMethod.GET, RequestMethod.POST})
|
|
public Map<String, String> wxPayNotify(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
|
|
|
|
|
public String wxPayNotify(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
|
String result = "";
|
|
String result = "";
|
|
String inputLine;
|
|
String inputLine;
|
|
while ((inputLine = request.getReader().readLine()) != null) {
|
|
while ((inputLine = request.getReader().readLine()) != null) {
|
|
@ -418,11 +437,12 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
|
|
request.getReader().close();
|
|
request.getReader().close();
|
|
//im处方发消息
|
|
//im处方发消息
|
|
Map<String,Object> wxrs = XMLUtil.xmltoMap(result);
|
|
Map<String,Object> wxrs = XMLUtil.xmltoMap(result);
|
|
|
|
Map<String, String> map = new HashedMap();
|
|
if("SUCCESS".equals(wxrs.get("return_code").toString())){
|
|
if("SUCCESS".equals(wxrs.get("return_code").toString())){
|
|
// 我方 订单号+时间差
|
|
// 我方 订单号+时间差
|
|
String seqNo = wxrs.get("out_trade_no")+"";
|
|
String seqNo = wxrs.get("out_trade_no")+"";
|
|
BusinessOrderDO businessOrderDO = businessOrderDao.selectByOrderNo(seqNo);
|
|
BusinessOrderDO businessOrderDO = businessOrderDao.selectByOrderNo(seqNo);
|
|
if (businessOrderDO.getStatus()!=1){
|
|
|
|
|
|
if (businessOrderDO.getStatus()!=1&&businessOrderDO.getStatus()!=9){
|
|
if (businessOrderDO!=null&&businessOrderDO.getOrderCategory().equalsIgnoreCase("4")){
|
|
if (businessOrderDO!=null&&businessOrderDO.getOrderCategory().equalsIgnoreCase("4")){
|
|
WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findOne(businessOrderDO.getRelationCode());
|
|
WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findOne(businessOrderDO.getRelationCode());
|
|
JSONObject object = (JSONObject) JSONObject.toJSON(wlyyPrescriptionDO);
|
|
JSONObject object = (JSONObject) JSONObject.toJSON(wlyyPrescriptionDO);
|
|
@ -440,10 +460,12 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
|
|
prescriptionVO.setPayStatus(1);
|
|
prescriptionVO.setPayStatus(1);
|
|
imService.pushPrescriptionImMessage(prescriptionVO);
|
|
imService.pushPrescriptionImMessage(prescriptionVO);
|
|
}
|
|
}
|
|
|
|
map= businessOrderService.getWxPayResultNotify(result);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
Map<String, String> map = businessOrderService.getWxPayResultNotify(result);
|
|
|
|
return map;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return XMLUtil.map2xml(map);
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|