|
@ -22,6 +22,8 @@ import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.json.JSONArray;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.MediaType;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
@ -41,6 +43,7 @@ import java.util.Map;
|
|
|
@RequestMapping(value = "doctor/device", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
@Api(value = "患者设备管理--医生端", description = "患者设备管理--医生端")
|
|
|
public class DoctorDeviceController extends BaseController {
|
|
|
private static Logger logger = LoggerFactory.getLogger(DoctorDeviceController.class);
|
|
|
|
|
|
@Autowired
|
|
|
private PatientDeviceService patientDeviceService;
|
|
@ -107,7 +110,7 @@ public class DoctorDeviceController extends BaseController {
|
|
|
patientDeviceService.saveDevice(device);
|
|
|
|
|
|
//修改设备表中是否是首绑{"1":"1", "2":"1"}修改成{"1":"0", "2":"0"} 和其他绑定信息,
|
|
|
wlyyDeviceDetailService.updateAfterBinding(device.getDeviceSn(),device.getUserIdcard(),device.getUserType(),new Date());
|
|
|
wlyyDeviceDetailService.updateAfterBinding(device.getDeviceSn(),device.getUserIdcard(),device.getUserType(),new Date(),flag);
|
|
|
//调用增加积分接口
|
|
|
System.out.println("是否首次====="+flag);
|
|
|
|
|
@ -125,26 +128,27 @@ public class DoctorDeviceController extends BaseController {
|
|
|
String flagType = String.valueOf(list.get(0).get("flag"));
|
|
|
|
|
|
//@TODO 调用发送微信模板接口
|
|
|
//Patient people = patientDao.findByCode(device.getUser());
|
|
|
String openId = patient.getOpenid();
|
|
|
String name = patient.getName();
|
|
|
|
|
|
org.json.JSONObject sendJson = new org.json.JSONObject();
|
|
|
String first = "";
|
|
|
String remark = "";
|
|
|
String deviceName = device.getDeviceName();
|
|
|
WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_patient_bind_device","bdsb");
|
|
|
first = templateConfig.getFirst();
|
|
|
first = first.replace("key1",(deviceName==null?"":deviceName));
|
|
|
remark = templateConfig.getRemark();
|
|
|
String keyword1 = templateConfig.getKeyword1();
|
|
|
|
|
|
sendJson.put("keyword1", keyword1);
|
|
|
sendJson.put("keyword2", device.getCzrq());
|
|
|
sendJson.put("first", first);
|
|
|
sendJson.put("remark", remark);
|
|
|
sendJson.put("url", templateConfig.getUrl());//带参数的模板跳转链接
|
|
|
pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 22, openId, name, sendJson);
|
|
|
try {
|
|
|
Patient people = patientDao.findByCode(device.getUser());
|
|
|
String openId = people.getOpenid();
|
|
|
String name = people.getName();
|
|
|
|
|
|
org.json.JSONObject sendJson = new org.json.JSONObject();
|
|
|
String first = "";
|
|
|
String remark = "";
|
|
|
String deviceName = device.getDeviceName();
|
|
|
WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_patient_bind_device","bdsb");
|
|
|
first = templateConfig.getFirst();
|
|
|
first = first.replace("key1",(deviceName==null?"":deviceName));
|
|
|
remark = templateConfig.getRemark();
|
|
|
String keyword1 = templateConfig.getKeyword1();
|
|
|
|
|
|
sendJson.put("keyword1", keyword1);
|
|
|
sendJson.put("keyword2", device.getCzrq());
|
|
|
sendJson.put("first", first);
|
|
|
sendJson.put("remark", remark);
|
|
|
sendJson.put("url", templateConfig.getUrl());//带参数的模板跳转链接
|
|
|
pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 22, openId, name, sendJson);
|
|
|
// //发送代理人
|
|
|
// jsonArray = weiXinOpenIdUtils.getAgentOpenId(patient, openId);
|
|
|
// if (jsonArray != null && jsonArray.length() > 0) {
|
|
@ -161,7 +165,11 @@ public class DoctorDeviceController extends BaseController {
|
|
|
// pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 19, member.getOpenid(), name, sendJson);
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
}catch (Exception e){
|
|
|
logger.info("设备绑定微信模板消息发送失败:"+e.getMessage());
|
|
|
// e.printStackTrace();
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|