|
@ -29,9 +29,12 @@ import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.http.NameValuePair;
|
|
|
import org.apache.http.message.BasicNameValuePair;
|
|
|
import org.json.JSONArray;
|
|
|
import org.json.JSONObject;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.http.MediaType;
|
|
|
import org.springframework.stereotype.Controller;
|
|
@ -40,6 +43,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
@ -88,6 +92,12 @@ public class ConsultController extends WeixinBaseController {
|
|
|
private PrescriptionDao prescriptionDao;
|
|
|
@Autowired
|
|
|
private ConsultDao consultDao;
|
|
|
@Value("${doctorAssistant.api}")
|
|
|
private String doctorAssistant;
|
|
|
@Value("${doctorAssistant.target_url}")
|
|
|
private String targetUrl;
|
|
|
@Autowired
|
|
|
private HttpClientUtil httpClientUtil;
|
|
|
|
|
|
|
|
|
/**
|
|
@ -382,10 +392,40 @@ public class ConsultController extends WeixinBaseController {
|
|
|
// 推送消息给医生
|
|
|
if(dts==null||dts.length()==0){
|
|
|
pushMsgTask.put(consult.getDoctor(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.D_CT_01.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.指定咨询.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.您有新的指定咨询.name(), consult.getConsult());
|
|
|
Doctor doctor = doctorDao.findByCode(consult.getDoctor());
|
|
|
if (doctor!=null && StringUtils.isNotEmpty(doctor.getOpenid())){
|
|
|
String url = doctorAssistant + "/wlyy/feldsher/sendDoctorTemplates";
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
params.add(new BasicNameValuePair("type", "4"));
|
|
|
params.add(new BasicNameValuePair("openId", doctor.getOpenid()));
|
|
|
params.add(new BasicNameValuePair("url", targetUrl));
|
|
|
params.add(new BasicNameValuePair("first", doctor.getName() + "医生您好,有患者向您发起咨询"));
|
|
|
params.add(new BasicNameValuePair("remark", "请进入手机APP查看"));
|
|
|
String sex = consult.getSex()==1? "男" : "女";
|
|
|
String keywords = consult.getName() + "," + sex;
|
|
|
params.add(new BasicNameValuePair("keywords", keywords));
|
|
|
|
|
|
httpClientUtil.post(url, params, "UTF-8");
|
|
|
}
|
|
|
}else {
|
|
|
for (int i=0;i<dts.length();i++){
|
|
|
String doctorCode = dts.getString(i);
|
|
|
pushMsgTask.put(doctorCode, MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.D_CT_01.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.指定咨询.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.您有新的指定咨询.name(), consult.getConsult());
|
|
|
Doctor doctor = doctorDao.findByCode(doctorCode);
|
|
|
if (doctor!=null && StringUtils.isNotEmpty(doctor.getOpenid())){
|
|
|
String url = doctorAssistant + "/wlyy/feldsher/sendDoctorTemplates";
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
params.add(new BasicNameValuePair("type", "4"));
|
|
|
params.add(new BasicNameValuePair("openId", doctor.getOpenid()));
|
|
|
params.add(new BasicNameValuePair("url", targetUrl));
|
|
|
params.add(new BasicNameValuePair("first", doctor.getName() + "医生您好,有患者向您发起咨询"));
|
|
|
params.add(new BasicNameValuePair("remark", "请进入手机APP查看"));
|
|
|
String sex = consult.getSex()==1? "男" : "女";
|
|
|
String keywords = consult.getName() + "," + sex;
|
|
|
params.add(new BasicNameValuePair("keywords", keywords));
|
|
|
|
|
|
httpClientUtil.post(url, params, "UTF-8");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
@ -756,6 +796,7 @@ public class ConsultController extends WeixinBaseController {
|
|
|
for (ConsultTeamLog log : logs) {
|
|
|
// String response = ImUtill.sendTopicIM(getUID(), patient.getName(), consult, String.valueOf(log.getType()), log.getContent());
|
|
|
String response = ImUtill.sendTopicIM(getRepUID(), patient.getName(), consult, String.valueOf(log.getType()), log.getContent(),agent);
|
|
|
|
|
|
if (StringUtils.isNotEmpty(response)) {
|
|
|
JSONObject resObj = new JSONObject(response);
|
|
|
if (resObj.getInt("status") == -1) {
|