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