|
@ -22,10 +22,14 @@ import com.yihu.wlyy.service.system.SystemDictService;
|
|
|
import com.yihu.wlyy.task.FollowupUploadTask;
|
|
|
import com.yihu.wlyy.task.PushMsgTask;
|
|
|
import com.yihu.wlyy.util.DateUtil;
|
|
|
import com.yihu.wlyy.util.HttpClientUtil;
|
|
|
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.data.domain.PageRequest;
|
|
|
import org.springframework.data.domain.Pageable;
|
|
@ -34,6 +38,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import javax.transaction.Transactional;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
@ -82,6 +87,12 @@ public class FollowUpService extends BaseService {
|
|
|
private PatientService patientService;
|
|
|
@Autowired
|
|
|
private PushMsgTask pushMsgTask;
|
|
|
@Value("${doctorAssistant.api}")
|
|
|
private String doctorAssistant;
|
|
|
@Value("${doctorAssistant.target_url}")
|
|
|
private String targetUrl;
|
|
|
@Autowired
|
|
|
private HttpClientUtil httpClientUtil;
|
|
|
|
|
|
|
|
|
/**
|
|
@ -680,6 +691,33 @@ public class FollowUpService extends BaseService {
|
|
|
list.add(message);
|
|
|
// 推送消息给医生
|
|
|
pushMsgTask.put(doctor, "4", title, content, "");
|
|
|
|
|
|
try {
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
List<Followup> followups = followupDao.getByDoctorPlan(doctor,format.parse(start),format.parse(end));
|
|
|
for (Followup followup:followups) {
|
|
|
// 新增发送医生助手模板消息 v1.4.0 by wujunjie
|
|
|
Doctor doctor1 = doctorDao.findByCode(doctor);
|
|
|
String doctorOpenID = doctor1.getOpenid();
|
|
|
if (StringUtils.isNotEmpty(doctorOpenID)) {
|
|
|
String url = doctorAssistant + "/wlyy/feldsher/sendDoctorTemplates";
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
params.add(new BasicNameValuePair("type", "6"));
|
|
|
params.add(new BasicNameValuePair("openId", doctorOpenID));
|
|
|
params.add(new BasicNameValuePair("url", targetUrl));
|
|
|
params.add(new BasicNameValuePair("first", "您今日有"+count+"个随访计划待处理"));
|
|
|
params.add(new BasicNameValuePair("remark", ""));
|
|
|
SimpleDateFormat formatDate = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
|
|
|
String newDate = formatDate.format(new Date());
|
|
|
String keywords = followup.getPatientName() + newDate + "," + "请进入手机APP查看";
|
|
|
params.add(new BasicNameValuePair("keywords", keywords));
|
|
|
|
|
|
httpClientUtil.post(url, params, "UTF-8");
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
messageDao.save(list);
|