|
@ -1,7 +1,6 @@
|
|
|
package com.yihu.wlyy.service.manager.feedback;
|
|
|
|
|
|
import com.yihu.wlyy.entity.Doctor;
|
|
|
import com.yihu.wlyy.entity.Followup;
|
|
|
import com.yihu.wlyy.entity.Message;
|
|
|
import com.yihu.wlyy.entity.Patient;
|
|
|
import com.yihu.wlyy.entity.feedback.Feedback;
|
|
@ -42,6 +41,8 @@ public class FeedbackService extends BaseService {
|
|
|
private DoctorDao doctorDao;
|
|
|
@Value("${wlyyService.api}")
|
|
|
private String wlyyService;
|
|
|
@Value("${image.imgUrlDomain}")
|
|
|
private String imgUrlDomain;
|
|
|
@Autowired
|
|
|
private MessageDao messageDao;
|
|
|
|
|
@ -148,8 +149,13 @@ public class FeedbackService extends BaseService {
|
|
|
map.put("name", name);
|
|
|
map.put("identity", identity);
|
|
|
map.put("contact", contact);
|
|
|
map.put("phone", feedback.getPhone());
|
|
|
map.put("idcard", feedback.getIdcard());
|
|
|
map.put("result", feedback.getResult());
|
|
|
map.put("createTime", feedback.getCreateTime());
|
|
|
map.put("description", description);
|
|
|
map.put("images", images);
|
|
|
map.put("imgUrlDomain", imgUrlDomain);
|
|
|
if (status == 0) {
|
|
|
feedbackDao.modifyFeedbackStatus(id, 1);
|
|
|
}
|
|
@ -173,10 +179,16 @@ public class FeedbackService extends BaseService {
|
|
|
* @param result
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public void dealFeedback(Long id, String result) throws Exception {
|
|
|
public Feedback dealFeedback(Long id, String result) throws Exception {
|
|
|
Feedback feedback = feedbackDao.findFeedbackById(id);
|
|
|
feedback.setResult(result);
|
|
|
feedback.setStatus(2);
|
|
|
feedbackDao.save(feedback);
|
|
|
return feedback;
|
|
|
}
|
|
|
|
|
|
public void sendMsg(Feedback feedback){
|
|
|
String result = feedback.getResult();
|
|
|
int identity = feedback.getIdentity();
|
|
|
int type = feedback.getType();
|
|
|
String typeName = null;
|
|
@ -195,57 +207,59 @@ public class FeedbackService extends BaseService {
|
|
|
typeName = "其他";
|
|
|
break;
|
|
|
}
|
|
|
if (identity == 1) {
|
|
|
//wlyy给患者发送模板消息
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
try{
|
|
|
if (identity == 1) {
|
|
|
//wlyy给患者发送模板消息
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
Patient patient = patientDao.findByCode(creater);
|
|
|
String patientName = patient.getName();
|
|
|
String patientOpendID = patient.getOpenid();
|
|
|
if (StringUtils.isNotEmpty(patientOpendID)) {
|
|
|
String url = wlyyService + "/patient/feedback/sendTemplate";
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
params.add(new BasicNameValuePair("toUser", patientOpendID));
|
|
|
params.add(new BasicNameValuePair("url", null));
|
|
|
params.add(new BasicNameValuePair("first", "您好!您提交的意见反馈已处理"));
|
|
|
params.add(new BasicNameValuePair("remark", "感谢你的意见"));
|
|
|
Patient patient = patientDao.findByCode(creater);
|
|
|
String patientName = patient.getName();
|
|
|
String patientOpendID = patient.getOpenid();
|
|
|
if (StringUtils.isNotEmpty(patientOpendID)) {
|
|
|
String url = wlyyService + "/patient/feedback/sendTemplate";
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
params.add(new BasicNameValuePair("toUser", patientOpendID));
|
|
|
params.add(new BasicNameValuePair("url", null));
|
|
|
params.add(new BasicNameValuePair("first", "您好!您提交的意见反馈已处理"));
|
|
|
params.add(new BasicNameValuePair("remark", "感谢你的意见"));
|
|
|
SimpleDateFormat formatDate = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
|
|
|
String newDate = formatDate.format(new Date());
|
|
|
String keywords = patientName + "," + typeName + "," + result + "," + newDate;
|
|
|
params.add(new BasicNameValuePair("keywords", keywords));
|
|
|
|
|
|
HttpClientUtil.post(url, params, "UTF-8");
|
|
|
}
|
|
|
} else if (identity == 2) {
|
|
|
SimpleDateFormat formatDate = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
|
|
|
String newDate = formatDate.format(new Date());
|
|
|
String keywords = patientName + "," + typeName + "," + result + "," + newDate;
|
|
|
params.add(new BasicNameValuePair("keywords", keywords));
|
|
|
String title = "新增系统消息";
|
|
|
String content = "您在" + newDate + "提交的意见反馈已处理,您可点此查看处理结果";
|
|
|
Message message = new Message();
|
|
|
message.setType(10);
|
|
|
message.setCode(UUID.randomUUID().toString());
|
|
|
message.setCzrq(new Date());
|
|
|
message.setCreateTime(new Date());
|
|
|
message.setContent(content);
|
|
|
message.setRead(1);//设置未读
|
|
|
message.setReceiver(creater);//设置接受医生的code
|
|
|
message.setSender("system");//设置发送的用户
|
|
|
message.setTitle(title);
|
|
|
message.setReadonly(1);//是否只读消息
|
|
|
|
|
|
//wlyy给医生发送系统消息
|
|
|
Doctor doctor = doctorDao.findByCode(creater);
|
|
|
String doctorOpenID = doctor.getOpenid();
|
|
|
String url = wlyyService + "/patient/feedback/sendMessage";
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
params.add(new BasicNameValuePair("receiver", creater));
|
|
|
params.add(new BasicNameValuePair("title", title));
|
|
|
params.add(new BasicNameValuePair("content",content));
|
|
|
|
|
|
HttpClientUtil.post(url, params, "UTF-8");
|
|
|
messageDao.save(message);
|
|
|
}
|
|
|
} else if (identity == 2) {
|
|
|
SimpleDateFormat formatDate = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
|
|
|
String newDate = formatDate.format(new Date());
|
|
|
String title = "新增系统消息";
|
|
|
String content = "您在" + newDate + "提交的意见反馈已处理,您可点此查看处理结果";
|
|
|
Message message = new Message();
|
|
|
message.setType(10);
|
|
|
message.setCode(UUID.randomUUID().toString());
|
|
|
message.setCzrq(new Date());
|
|
|
message.setCreateTime(new Date());
|
|
|
message.setContent(content);
|
|
|
message.setRead(1);//设置未读
|
|
|
message.setReceiver(creater);//设置接受医生的code
|
|
|
message.setSender("system");//设置发送的用户
|
|
|
message.setTitle(title);
|
|
|
message.setReadonly(1);//是否只读消息
|
|
|
|
|
|
//wlyy给医生发送系统消息
|
|
|
Doctor doctor = doctorDao.findByCode(creater);
|
|
|
String doctorOpenID = doctor.getOpenid();
|
|
|
String url = wlyyService + "/patient/feedback/sendMessage";
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
params.add(new BasicNameValuePair("receiver", creater));
|
|
|
params.add(new BasicNameValuePair("title", title));
|
|
|
params.add(new BasicNameValuePair("content",content));
|
|
|
|
|
|
HttpClientUtil.post(url, params, "UTF-8");
|
|
|
messageDao.save(message);
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
feedbackDao.save(feedback);
|
|
|
|
|
|
}
|
|
|
}
|