|
@ -2,17 +2,29 @@ package com.yihu.wlyy.web.doctor.prescription;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.yihu.wlyy.aop.ObserverRequired;
|
|
import com.yihu.wlyy.aop.ObserverRequired;
|
|
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
import com.yihu.wlyy.entity.patient.prescription.Prescription;
|
|
import com.yihu.wlyy.entity.patient.prescription.Prescription;
|
|
|
|
import com.yihu.wlyy.repository.doctor.DoctorDao;
|
|
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
|
|
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
|
|
import com.yihu.wlyy.service.app.prescription.PrescriptionAdjustService;
|
|
import com.yihu.wlyy.service.app.prescription.PrescriptionAdjustService;
|
|
import com.yihu.wlyy.service.third.jw.JwPrescriptionService;
|
|
import com.yihu.wlyy.service.third.jw.JwPrescriptionService;
|
|
|
|
import com.yihu.wlyy.util.HttpClientUtil;
|
|
import com.yihu.wlyy.web.BaseController;
|
|
import com.yihu.wlyy.web.BaseController;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiParam;
|
|
import io.swagger.annotations.ApiParam;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.apache.http.NameValuePair;
|
|
|
|
import org.apache.http.message.BasicNameValuePair;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
/**
|
|
* Created by yeshijie on 2017/8/17.
|
|
* Created by yeshijie on 2017/8/17.
|
|
*/
|
|
*/
|
|
@ -27,6 +39,14 @@ public class PrescriptionAdjustController extends BaseController {
|
|
private PrescriptionDao prescriptionDao;
|
|
private PrescriptionDao prescriptionDao;
|
|
@Autowired
|
|
@Autowired
|
|
private PrescriptionAdjustService prescriptionAdjustService;
|
|
private PrescriptionAdjustService prescriptionAdjustService;
|
|
|
|
@Autowired
|
|
|
|
private DoctorDao doctorDao;
|
|
|
|
@Value("${doctorAssistant.api}")
|
|
|
|
private String doctorAssistant;
|
|
|
|
@Value("${doctorAssistant.target_url}")
|
|
|
|
private String targetUrl;
|
|
|
|
@Autowired
|
|
|
|
private HttpClientUtil httpClientUtil;
|
|
|
|
|
|
@RequestMapping(value = "adjustPrescription",method = RequestMethod.POST)
|
|
@RequestMapping(value = "adjustPrescription",method = RequestMethod.POST)
|
|
@ObserverRequired
|
|
@ObserverRequired
|
|
@ -44,6 +64,29 @@ public class PrescriptionAdjustController extends BaseController {
|
|
if(json.getInteger("status")==-1){
|
|
if(json.getInteger("status")==-1){
|
|
return error(-1,json.getString("msg"));
|
|
return error(-1,json.getString("msg"));
|
|
}
|
|
}
|
|
|
|
try {
|
|
|
|
// 新增发送医生助手模板消息 v1.4.0 by wujunjie
|
|
|
|
Prescription prescription = prescriptionDao.findByCode(code);
|
|
|
|
Doctor doctor = doctorDao.findByCode(prescription.getDoctor());
|
|
|
|
String doctorOpenID = doctor.getOpenid();
|
|
|
|
if (StringUtils.isNotEmpty(doctorOpenID)) {
|
|
|
|
String url = doctorAssistant + "/wlyy/feldsher/sendDoctorTemplates";
|
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
|
params.add(new BasicNameValuePair("type", "9"));
|
|
|
|
params.add(new BasicNameValuePair("openId", doctorOpenID));
|
|
|
|
params.add(new BasicNameValuePair("url", targetUrl));
|
|
|
|
params.add(new BasicNameValuePair("first", doctor.getName() + "医生您好。您有1个续方申请已在线下调整完成,请尽快进行CA认证."));
|
|
|
|
params.add(new BasicNameValuePair("remark", "请进入手机APP查看"));
|
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
|
|
|
|
String date = format.format(new Date());
|
|
|
|
String keywords = "续方审核CA认证" +"," + date;
|
|
|
|
params.add(new BasicNameValuePair("keywords", keywords));
|
|
|
|
|
|
|
|
httpClientUtil.post(url, params, "UTF-8");
|
|
|
|
}
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
return write(200,"请求调整成功");
|
|
return write(200,"请求调整成功");
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
error(e);
|
|
error(e);
|