|
@ -1,5 +1,6 @@
|
|
package com.yihu.wlyy.service.app.prescription;
|
|
package com.yihu.wlyy.service.app.prescription;
|
|
|
|
|
|
|
|
import com.yihu.wlyy.util.HttpUtil;
|
|
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
|
|
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
|
|
import com.yihu.wlyy.wechat.util.WeiXinMessageUtils;
|
|
import com.yihu.wlyy.wechat.util.WeiXinMessageUtils;
|
|
import org.json.JSONObject;
|
|
import org.json.JSONObject;
|
|
@ -17,6 +18,8 @@ import com.yihu.wlyy.util.ImUtill;
|
|
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;
|
|
import org.json.JSONArray;
|
|
import org.json.JSONArray;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@ -55,10 +58,10 @@ public class PrescriptionInfoService extends BaseService {
|
|
@Autowired
|
|
@Autowired
|
|
private PrescriptionNoticesService prescriptionNoticesService;
|
|
private PrescriptionNoticesService prescriptionNoticesService;
|
|
@Autowired
|
|
@Autowired
|
|
private WeiXinAccessTokenUtils weiXinAccessTokenUtils;
|
|
|
|
@Autowired
|
|
|
|
private ImUtill imUtill;
|
|
private ImUtill imUtill;
|
|
|
|
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(HttpUtil.class);
|
|
|
|
|
|
/**
|
|
/**
|
|
* 获取处方下的详细药品
|
|
* 获取处方下的详细药品
|
|
* @param prescriptionCode
|
|
* @param prescriptionCode
|
|
@ -659,13 +662,20 @@ public class PrescriptionInfoService extends BaseService {
|
|
}
|
|
}
|
|
//
|
|
//
|
|
public int onMesSquareState(String mes){
|
|
public int onMesSquareState(String mes){
|
|
JSONObject json = new JSONObject(mes);
|
|
|
|
Integer state = json.getInt("state");
|
|
|
|
String code = json.getString("prescription");
|
|
|
|
Prescription prescription = prescriptionDao.findByCode(code);
|
|
|
|
Patient p = patientDao.findByCode(prescription.getPatient());
|
|
|
|
if(state!=null&&state==1){
|
|
|
|
//prescriptionNoticesService.sendMessages(weiXinAccessTokenUtils.getAccessToken(),prescription.getDoctor(),p.getCode());
|
|
|
|
|
|
try{
|
|
|
|
JSONObject json = new JSONObject(mes);
|
|
|
|
Integer state = json.getInt("state");
|
|
|
|
String code = json.getString("prescription");
|
|
|
|
Prescription prescription = prescriptionDao.findByCode(code);
|
|
|
|
Patient p = patientDao.findByCode(prescription.getPatient());
|
|
|
|
if(state!=null&&state==1){
|
|
|
|
prescriptionNoticesService.sendMessages(p.getOpenid(),p.getName(),prescription.getDoctorName(),null,1,1,"/html/prescription/html/re-prescription_info.html?openid=" + p.getOpenid() + "&toUser=" + p.getCode()+ "&toName=" + p.getName() +"&code="+prescription.getCode());
|
|
|
|
}else{
|
|
|
|
prescriptionNoticesService.sendMessages(p.getOpenid(),p.getName(),prescription.getDoctorName(),null,1,2,"/html/prescription/html/re-prescription_info.html?openid=" + p.getOpenid() + "&toUser=" + p.getCode()+ "&toName=" + p.getName() +"&code="+prescription.getCode());
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}catch (Exception e){
|
|
|
|
logger.error("续方消息发送失败!",e);
|
|
}
|
|
}
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|