zd_123 7 vuotta sitten
vanhempi
commit
1f5397775d

+ 5 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/deviece/WlyyDeviceDetailDao.java

@ -21,5 +21,9 @@ public interface WlyyDeviceDetailDao extends PagingAndSortingRepository<DeviceDe
	@Modifying
	@Query("update DeviceDetail dd set dd.isGrant=1,dd.grantAdminTeam=?1,dd.grantHospital=?2,dd.bindingCount=?3,dd.grantTime = ?4 where dd.deviceCode=?5")
	void updateAfterBinding(long adminTeam, String hospital, String isFirstBinding, Date grantTime,String deviceSn);
	void updateAfterBindingFirst(long adminTeam, String hospital, String isFirstBinding, Date grantTime,String deviceSn);
	@Modifying
	@Query("update DeviceDetail dd set dd.isGrant=1,dd.grantAdminTeam=?1,dd.grantHospital=?2,dd.bindingCount=?3 where dd.deviceCode=?4")
	void updateAfterBinding(long adminTeam, String hospital, String isFirstBinding,String deviceSn);
}

+ 6 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/device/WlyyDeviceDetailService.java

@ -31,7 +31,7 @@ public class WlyyDeviceDetailService extends BaseService {
		return  wlyyDeviceDetailDao.findByDeviceSn(sn);
	}
	public void updateAfterBinding(String deviceSn, String idCard, String userType, Date grantTime)throws Exception{
	public void updateAfterBinding(String deviceSn, String idCard, String userType, Date grantTime,boolean isFirst)throws Exception{
		DeviceDetail deviceDetail = wlyyDeviceDetailDao.findByDeviceSn(deviceSn);
		List<SignFamily> signFamilyList = signFamilyDao.findSSandJTByIdcard(idCard);
		Long adminTeam=0L;
@ -54,7 +54,11 @@ public class WlyyDeviceDetailService extends BaseService {
				isFirstBind = jsonObject.toJSONString();
			}
		}
		wlyyDeviceDetailDao.updateAfterBinding(adminTeam,hospital,isFirstBind,grantTime,deviceSn );
		if (isFirst){
			wlyyDeviceDetailDao.updateAfterBindingFirst(adminTeam,hospital,isFirstBind,grantTime,deviceSn);
		}else {
			wlyyDeviceDetailDao.updateAfterBinding(adminTeam,hospital,isFirstBind,deviceSn);
		}
	}
}

+ 2 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java

@ -5160,7 +5160,8 @@ public class StatisticsESService {
        String index_85 = "85";
        String index_86= "86";
        String lastDate = year + "-06-30";
        String timeKey = elasticsearchUtil.getQuotaTime();
        //String timeKey = elasticsearchUtil.getQuotaTime();
        String timeKey = DateUtil.getStringDateShort();
        String low_level = String.valueOf(StringUtils.isEmpty(lowLevel) ? (level + 1) : lowLevel);
        List<Map<String, Object>> resultList = new ArrayList<>();
        Map<String,Object> resultMap = new HashedMap();

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

@ -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();
	                    }
                    }
                }
			}

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

@ -13,10 +13,13 @@ 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.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.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
@ -33,6 +36,7 @@ import java.util.Map;
@RequestMapping(value = "/healthBank",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "积分处理机制")
public class CreditsLogController extends BaseController {
    private static Logger logger = LoggerFactory.getLogger(CreditsLogController.class);
    @Autowired
    private CreditLogService service;
@ -95,29 +99,30 @@ public class CreditsLogController extends BaseController {
                    String patientid = String.valueOf(list.get(0).get("patientId"));
                    
                    
                    //@TODO 获取积分调用发送微信模板接口
                    Patient people = patientDao.findByCode(patientid);
                    String openId = people.getOpenid();
                    String name = people.getName();
                    try {
                        //@TODO 获取积分调用发送微信模板接口
                        Patient people = patientDao.findByCode(patientid);
                        String openId = people.getOpenid();
                        String name = people.getName();
    
                    org.json.JSONObject sendJson = new org.json.JSONObject();
                    String first = "";
                    String remark = "";
                    String url = "";
                    
                    WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_healthbank_credit","jfdztz");
                    first = templateConfig.getFirst();
                    remark = templateConfig.getRemark();
                        org.json.JSONObject sendJson = new org.json.JSONObject();
                        String first = "";
                        String remark = "";
                        String url = "";
    
                        WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_healthbank_credit","jfdztz");
                        first = templateConfig.getFirst();
                        remark = templateConfig.getRemark();
//                    String keyword1 = templateConfig.getKeyword1();
    
                    sendJson.put("keyword1", integrate);
                    sendJson.put("keyword2", DateUtil.getStringDate());
                    sendJson.put("first", first);
                    sendJson.put("remark", remark);
                    url = templateConfig.getUrl();
                    url = url.replace("key1",(integrate==null?"":integrate));
                    sendJson.put("url", url);//带参数的模板跳转链接
                    pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 23, openId, name, sendJson);
                        sendJson.put("keyword1", integrate);
                        sendJson.put("keyword2", DateUtil.getStringDate());
                        sendJson.put("first", first);
                        sendJson.put("remark", remark);
                        url = templateConfig.getUrl();
                        url = url.replace("key1",(integrate==null?"":integrate));
                        sendJson.put("url", url);//带参数的模板跳转链接
                        pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 23, openId, name, sendJson);
//	                    //发送代理人
//	                    jsonArray = weiXinOpenIdUtils.getAgentOpenId(patient, openId);
//	                    if (jsonArray != null && jsonArray.length() > 0) {
@ -134,6 +139,11 @@ public class CreditsLogController extends BaseController {
//			                    pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 19, member.getOpenid(), name, sendJson);
//		                    }
//	                    }
                    }catch (Exception e){
                        logger.info("健康银行居民新增积分,微信模板消息发送失败:"+e.getMessage());
//	                        e.printStackTrace();
                    }
                }
            }
            return write(200,"添加成功","data",result);