Parcourir la source

Merge branch 'dev' of chinawu123/wlyy2.0 into dev

chinawu123 il y a 2 ans
Parent
commit
c3d28b6ca0

+ 11 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/admin/CommonEndpoint.java

@ -92,7 +92,6 @@ public class CommonEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value = "open/patienPushOnOff")
    @ApiOperation(value = "初始化居民消息订阅开关")
    public Envelop patienPushOnOff(){
        try {
            patientPushOnOffUtil.patientPushOnOff();
            return success("初始化成功!");
@ -100,7 +99,18 @@ public class CommonEndpoint extends EnvelopRestEndpoint {
            e.printStackTrace();
            return failedException2(e);
        }
    }
    @GetMapping(value = "open/newSignPatienPushOnOff")
    @ApiOperation(value = "初始化新签约居民消息订阅开关")
    public Envelop newSignPatienPushOnOff(){
        try {
            patientPushOnOffUtil.patientPushOnOffInitialize();
            return success("初始化成功!");
        } catch (Exception e) {
            e.printStackTrace();
            return failedException2(e);
        }
    }

+ 3 - 3
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doctor/DoctorBirthdayWishesEndpoint.java

@ -23,7 +23,6 @@ import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
@ -289,10 +288,11 @@ public class DoctorBirthdayWishesEndpoint extends BaseController {
            String patient = one.getPatientCode();
            //判断居民是否开启开关
            String patientOnOffSql = "select on_off from base_patient_pad_pushonoff where patient = '" + patient + "' and type = 7";
            Integer integer = jdbcTemplate.queryForObject(patientOnOffSql, new BeanPropertyRowMapper<>(Integer.class));
            if (!(integer==0?false:true)){
            Integer integer = jdbcTemplate.queryForObject(patientOnOffSql,Integer.class);
            if (integer==0?true:false){
                return;
            }
            System.out.println("生日祝福发送");
            if (StringUtils.isNotBlank(patient)){
                String sql = " select p.id as patient,p.name,we.openid from base_patient p Left join  base_patient_wechat we on p.id = we.patient_id " +
                        "where p.id = '"+patient+"' " +

+ 50 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/util/PatientPushOnOffUtil.java

@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.dao.log.BasePatientPadPushOnOffDao;
import com.yihu.jw.entity.log.BasePatientPadPushOnOffEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@ -76,4 +77,53 @@ public class PatientPushOnOffUtil {
    }
    //初始化新签约居民开关
    @Transactional(rollbackFor = Exception.class)
    public void patientPushOnOffInitialize(){
        JSONObject jsonObject = new JSONObject();
        JSONArray jsonArray = new JSONArray();
        jsonObject.put("1","时间整点报时");
        jsonArray.add(jsonObject);
        jsonObject.put("2","智能安居设备状态播报(必选)");
        jsonArray.add(jsonObject);
        jsonObject.put("3","体征测量消息");
        jsonArray.add(jsonObject);
        jsonObject.put("4","用药提醒");
        jsonArray.add(jsonObject);
        jsonObject.put("5","天气预报");
        jsonArray.add(jsonObject);
        jsonObject.put("6","服务预约提醒");
        jsonArray.add(jsonObject);
        jsonObject.put("7","生日祝福提醒");
        jsonArray.add(jsonObject);
        jsonObject.put("8","热点新闻播报");
        jsonArray.add(jsonObject);
        String sql = "SELECT p.id FROM  base_patient p  WHERE  p.sign_status = 1 AND p.del = 1 and p.id not in(SELECT patient FROM  base_patient_pad_pushonoff GROUP BY patient)";
        List<String> patientList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(String.class));
        List<BasePatientPadPushOnOffEntity> onOffEntityList = new ArrayList<>();
        patientList.forEach(patientId -> {
            for (int i = 1; i <= jsonArray.size(); i++) {
                BasePatientPadPushOnOffEntity onOffEntity = new BasePatientPadPushOnOffEntity();
                onOffEntity.setPatient(patientId);
                onOffEntity.setType(i);
                onOffEntity.setTypeName(jsonArray.getJSONObject(0).getString(i+""));
                if (jsonArray.getJSONObject(0).getString(i+"").equals("智能安居设备状态播报(必选)")){
                    onOffEntity.setOnOff(1);
                }else {
                    onOffEntity.setOnOff(0);
                }
                onOffEntity.setCreateTime(new Date());
                onOffEntityList.add(onOffEntity);
            }
        });
        basePatientPadPushOnOffDao.save(onOffEntityList);
    }
}