|
@ -102,31 +102,34 @@ public class DoctorDeviceController extends BaseController {
|
|
@RequestParam(value="data",required = true) String data) {
|
|
@RequestParam(value="data",required = true) String data) {
|
|
try {
|
|
try {
|
|
PatientDevice device = objectMapper.readValue(data,PatientDevice.class);
|
|
PatientDevice device = objectMapper.readValue(data,PatientDevice.class);
|
|
|
|
|
|
// 设置操作医生标识
|
|
// 设置操作医生标识
|
|
device.setDoctor(getUID());
|
|
device.setDoctor(getUID());
|
|
//首绑加分判断
|
|
|
|
boolean flag = patientDeviceService.isFirstNewBinding(device.getDeviceSn(),device.getUserType());
|
|
|
|
|
|
//首绑和设备类型判断
|
|
|
|
Map<String,Object> checkMap = patientDeviceService.checkBindingFirstAndType(device);
|
|
|
|
boolean flag = (Boolean)checkMap.get("flag");
|
|
|
|
int checkCode = Integer.valueOf(String.valueOf(checkMap.get("code")));
|
|
|
|
//已经绑定过同样的设备类型了,无法继续绑定
|
|
|
|
if (checkCode == -10000){
|
|
|
|
return write(-1,String.valueOf(checkMap.get("msg")));
|
|
|
|
}
|
|
//绑定
|
|
//绑定
|
|
patientDeviceService.saveDevice(device);
|
|
patientDeviceService.saveDevice(device);
|
|
|
|
|
|
//修改设备表中{"1":"0", "2":"0"}绑定次数 和其他绑定信息,
|
|
//修改设备表中{"1":"0", "2":"0"}绑定次数 和其他绑定信息,
|
|
wlyyDeviceDetailService.updateAfterBinding(device.getDeviceSn(),device.getUserIdcard(),device.getUserType(),new Date(),flag);
|
|
wlyyDeviceDetailService.updateAfterBinding(device.getDeviceSn(),device.getUserIdcard(),device.getUserType(),new Date(),flag);
|
|
//调用增加积分接口
|
|
|
|
if (flag){
|
|
|
|
Patient patient = patientService.findByCode(device.getUser());
|
|
|
|
|
|
Patient patient = patientDao.findByCode(device.getUser());
|
|
|
|
//调用增加积分接口 海沧区的居民才能添加积分
|
|
|
|
if (flag && "350205".equals(patient.getTown())){
|
|
String creditDetail = "{\"tradeType\":\"HEALTH_TASK\",\"flag\":\"BIND\",\"tradeDirection\":1,\"status\":1,\"patientId\":\""+device.getUser()+"\",\"hospital\":\""+patient.getTown()+"\"}";
|
|
String creditDetail = "{\"tradeType\":\"HEALTH_TASK\",\"flag\":\"BIND\",\"tradeDirection\":1,\"status\":1,\"patientId\":\""+device.getUser()+"\",\"hospital\":\""+patient.getTown()+"\"}";
|
|
JSONObject jsonObject = JSONObject.parseObject(creditDetail);
|
|
JSONObject jsonObject = JSONObject.parseObject(creditDetail);
|
|
JSONObject response = creditLogService.insert(jsonObject);
|
|
JSONObject response = creditLogService.insert(jsonObject);
|
|
String status = response.getString("status");
|
|
String status = response.getString("status");
|
|
if (!"200".equals(status)){
|
|
if (!"200".equals(status)){
|
|
logger.info("添加积分失败!");
|
|
logger.info("添加积分失败!");
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
try {
|
|
try {
|
|
Patient people = patientDao.findByCode(device.getUser());
|
|
|
|
String openId = people.getOpenid();
|
|
|
|
String name = people.getName();
|
|
|
|
|
|
String openId = patient.getOpenid();
|
|
|
|
String name = patient.getName();
|
|
|
|
|
|
org.json.JSONObject sendJson = new org.json.JSONObject();
|
|
org.json.JSONObject sendJson = new org.json.JSONObject();
|
|
String first = "";
|
|
String first = "";
|