瀏覽代碼

Merge branch 'dev' of huangwenjie/patient-co-management into dev

huangwenjie 7 年之前
父節點
當前提交
115f813753

+ 2 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/device/DoctorDeviceController.java

@ -15,6 +15,7 @@ import com.yihu.wlyy.service.app.team.AdminTeamService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.service.third.health.bank.CreditLogService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.web.BaseController;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import io.swagger.annotations.Api;
@ -137,7 +138,7 @@ public class DoctorDeviceController extends BaseController {
				remark = templateConfig.getRemark();
				sendJson.put("keyword1", deviceName);
				sendJson.put("keyword2", device.getCzrq());
				sendJson.put("keyword2", DateUtil.dateToStrLong(device.getCzrq()));
				sendJson.put("keyword3", templateConfig.getKeyword3());
				sendJson.put("first", first);
				sendJson.put("remark", remark);

+ 48 - 36
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/device/PatientDeviceController.java

@ -15,14 +15,18 @@ import com.yihu.wlyy.service.app.health.PatientHealthIndexService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.service.third.health.bank.CreditLogService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.web.BaseController;
import com.yihu.wlyy.web.doctor.device.DoctorDeviceController;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
@ -46,6 +50,7 @@ import java.util.Map;
@RequestMapping(value = "patient/device")
@Api(value = "患者设备管理", description = "患者设备管理")
public class PatientDeviceController extends BaseController {
    private static Logger logger = LoggerFactory.getLogger(PatientDeviceController.class);
    @Autowired
    private PatientDeviceService patientDeviceService;
@ -222,8 +227,8 @@ public class PatientDeviceController extends BaseController {
            if (deviceDetail!=null){
                //修改设备表中{"1":"0", "2":"0"}的绑定次数 和其他绑定信息,
                wlyyDeviceDetailService.updateAfterBinding(device.getDeviceSn(),device.getUserIdcard(),device.getUserType(),new Date(),flag);
                Patient patient = patientService.findByCode(device.getUser());
                if (flag){
                    Patient patient = patientService.findByCode(device.getUser());
                    String creditDetail = "{\"tradeType\":\"HEALTH_TASK\",\"flag\":\"BIND\",\"tradeDirection\":1,\"status\":1,\"patientId\":\""+device.getUser()+"\",\"hospital\":\""+patient.getTown()+"\"}";
                    com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(creditDetail);
                    com.alibaba.fastjson.JSONObject response = creditLogService.insert(jsonObject);
@ -236,44 +241,51 @@ public class PatientDeviceController 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);
//	                        //发送代理人
//	                        jsonArray = weiXinOpenIdUtils.getAgentOpenId(patient, openId);
//	                        if (jsonArray != null && jsonArray.length() > 0) {
//		                        for (int i = 0; i < jsonArray.length(); i++) {
//			                        org.json.JSONObject j = jsonArray.getJSONObject(i);
//			                        Patient member = (Patient) j.get("member");
//			                        int start = url.indexOf("&toUser=");
//			                        int end = url.indexOf("&", start + 1);
//			                        String touser = url.substring(start, end);
//			                        url = url.replace(touser, "&toUser=" + member.getCode());
//			                        //name患者姓名
//			                        sendJson.put("first", weiXinOpenIdUtils.getTitleMes(people, (int) j.get("relation"), name) + first);
//			                        sendJson.put("url", url);
//			                        pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 19, member.getOpenid(), name, sendJson);
//		                        }
//	                        }
                        }
                    }
                }
    
                try {
                    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();
        
                    sendJson.put("keyword1", deviceName);
                    sendJson.put("keyword2", DateUtil.dateToStrLong(device.getCzrq()));
                    sendJson.put("keyword3", templateConfig.getKeyword3());
                    sendJson.put("first", first);
                    sendJson.put("remark", remark);
                    sendJson.put("url", templateConfig.getUrl());//带参数的模板跳转链接
                    System.out.println(sendJson.toString());
                    pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 22, openId, name, sendJson);
//	                    //发送代理人
//	                    jsonArray = weiXinOpenIdUtils.getAgentOpenId(patient, openId);
//	                    if (jsonArray != null && jsonArray.length() > 0) {
//		                    for (int i = 0; i < jsonArray.length(); i++) {
//			                    org.json.JSONObject j = jsonArray.getJSONObject(i);
//			                    Patient member = (Patient) j.get("member");
//			                    int start = url.indexOf("&toUser=");
//			                    int end = url.indexOf("&", start + 1);
//			                    String touser = url.substring(start, end);
//			                    url = url.replace(touser, "&toUser=" + member.getCode());
//			                    //name患者姓名
//			                    sendJson.put("first", weiXinOpenIdUtils.getTitleMes(people, (int) j.get("relation"), name) + first);
//			                    sendJson.put("url", url);
//			                    pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 19, member.getOpenid(), name, sendJson);
//		                    }
//	                    }
                }catch (Exception e){
                    logger.info("设备绑定微信模板消息发送失败:"+e.getMessage());
//	                        e.printStackTrace();
                }
            }

+ 2 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/health/bank/CreditsLogController.java

@ -91,6 +91,8 @@ public class CreditsLogController extends BaseController {
            JSONObject result = service.insert(object);
    
            String status = result.getString("status");
    
            logger.info("健康银行居民新增积分:"+result.toString());
            if ("200".equals(status)){
                List<Map<String,Object>> list = (List<Map<String,Object>>)result.get("detailModelList");
                if (list!=null && list.size()>0){