public function homeAction() { $p = $_REQUEST; $tTime = time(); #透析提醒 $tSDMO = new BqeschedulingdetailModel(); $tSDRow = $tSDMO->field('time_code,scheduling_date')->where('uid =' . $this->tUid . ' and scheduling_date >= \'' . date('Y-m-d', $tTime) . '\'')->order('scheduling_date asc')->limit('1')->fRow(); #透析地点 天气 $tCMO = new CenterModel(); $tSql = 'select name,today_weather from (select medical_id from user_assessment where uid = ' . $this->tUid . ') ua,center where ua.medical_id = center.id'; $tCDatas = $tCMO->query($tSql); $tCDatas = isset($tCDatas[0]) ? $tCDatas[0] : ''; Tool_Fnc::ajaxMsg('', 1, array('scheduling' => $tSDRow, 'center' => $tCDatas)); }
public function indexAction() { echo '<pre>'; $tTime = time(); $tBSDMO = new BqeschedulingdetailModel(); $tUAMO = new UserassessmentModel(); $Oci = new Orm_Oci(); #$tHSql = 'select to_char(SCHEDULING_DATE,\'YYYY-mm-dd\') scheduling_date,machine_id,time_code,patient_id,status,close_operator,to_char(close_time,\'YYYY-mm-dd HH:ii:ss\') close_time from scheduling_detail where to_char(SCHEDULING_DATE,\'YYYY-mm-dd\') between \''.date('Y-m-d',$tTime-86400*90).'\' and \''.date('Y-m-d',$tTime+86400*3).'\' order by SCHEDULING_DATE desc'; $tHSql = 'select to_char(SCHEDULING_DATE,\'YYYY-mm-dd\') scheduling_date,machine_id,time_code,patient_id,status,close_operator,to_char(close_time,\'YYYY-mm-dd HH:ii:ss\') close_time from scheduling_detail where to_char(SCHEDULING_DATE,\'YYYY-mm-dd\') between \'' . date('Y-m-d', $tTime - 86400) . '\' and \'' . date('Y-m-d', $tTime + 86400 * 3) . '\' order by SCHEDULING_DATE desc'; $tDatas = $Oci->getAll($tHSql); foreach ($tDatas as $tRow) { $tBSDRow = $tBSDMO->field('id,status,time_code,uid')->where('patient_id = \'' . $tRow['PATIENT_ID'] . '\' and scheduling_date = \'' . $tRow['SCHEDULING_DATE'] . '\'')->fRow(); if (count($tBSDRow)) { #记录存在 $tData = array(); if ($tBSDRow['status'] != $tRow['STATUS']) { $tData['status'] = $tRow['STATUS']; } if ($tBSDRow['time_code'] != $tRow['TIME_CODE']) { $tData['time_code'] = $tRow['TIME_CODE']; } if (empty($tBSDRow['uid'])) { #获取UID,纠正注册完白求恩用户 $tUARow = $tUAMO->field('uid')->where('patient_id = \'' . $tRow['PATIENT_ID'] . '\'')->fRow(); $tData['uid'] = empty($tUARow['uid']) ? 0 : $tUARow['uid']; } if (!count($tData)) { continue; } $tData = array_merge($tData, array('updated' => $tTime, 'id' => $tBSDRow['id'], 'close_operator' => $tRow['CLOSE_OPERATOR'], 'close_time' => $tRow['CLOSE_TIME'])); $tBSDMO->update($tData); } else { $tData = array('scheduling_date' => $tRow['SCHEDULING_DATE'], 'machine_id' => $tRow['MACHINE_ID'], 'time_code' => $tRow['TIME_CODE'], 'patient_id' => $tRow['PATIENT_ID'], 'status' => $tRow['STATUS'], 'close_operator' => $tRow['CLOSE_OPERATOR'], 'close_time' => $tRow['CLOSE_TIME'], 'created' => $tTime); $tUARow = $tUAMO->field('uid')->where('patient_id = \'' . $tRow['PATIENT_ID'] . '\'')->fRow(); $tData['uid'] = empty($tUARow['uid']) ? 0 : $tUARow['uid']; $tBSDMO->insert($tData); } } exit; }
public function dietAction() { $p = $_REQUEST; $pDate = empty($p['date']) ? Tool_Fnc::ajaxMsg('日期不能为空') : trim($p['date']); if (!Tool_Validate::is_date($pDate)) { Tool_Fnc::ajaxMsg('日期不正确'); } $tFAMO = new R_FoodaddModel(); $tFMO = new FoodModel(); $tSql = 'select * from (select fid,unit,amount,weight from ' . $tFAMO->table . ' where uid = ' . $this->tUid . ' and created >=' . strtotime($pDate) . ' and created <=' . strtotime($pDate . ' 23:59:59') . ') fa, ' . $tFMO->table . ' f where fa.fid = f.id'; $tList = $tFMO->query($tSql); # if(!count($tList)){Tool_Fnc::ajaxMsg('',1);} $tDatas = array(); $tDatasother = array(); #已经摄取 isset($tDatasother['calcium']['number']) ? '' : ($tDatasother['calcium']['number'] = 0); isset($tDatasother['vitamin_a']['number']) ? '' : ($tDatasother['vitamin_a']['number'] = 0); isset($tDatasother['zinc']['number']) ? '' : ($tDatasother['zinc']['number'] = 0); isset($tDatasother['magnesium']['number']) ? '' : ($tDatasother['magnesium']['number'] = 0); isset($tDatasother['vitamin_c']['number']) ? '' : ($tDatasother['vitamin_c']['number'] = 0); isset($tDatasother['fiber_dietary']['number']) ? '' : ($tDatasother['fiber_dietary']['number'] = 0); isset($tDatasother['selenium']['number']) ? '' : ($tDatasother['selenium']['number'] = 0); isset($tDatasother['copper']['number']) ? '' : ($tDatasother['copper']['number'] = 0); isset($tDatasother['fat']['number']) ? '' : ($tDatasother['fat']['number'] = 0); isset($tDatasother['niacin']['number']) ? '' : ($tDatasother['niacin']['number'] = 0); isset($tDatasother['vitamin_e']['number']) ? '' : ($tDatasother['vitamin_e']['number'] = 0); isset($tDatasother['manganese']['number']) ? '' : ($tDatasother['manganese']['number'] = 0); isset($tDatasother['cholesterol']['number']) ? '' : ($tDatasother['cholesterol']['number'] = 0); isset($tDatasother['iron']['number']) ? '' : ($tDatasother['iron']['number'] = 0); isset($tDatasother['thiamine']['number']) ? '' : ($tDatasother['thiamine']['number'] = 0); isset($tDatasother['lactoflavin']['number']) ? '' : ($tDatasother['lactoflavin']['number'] = 0); isset($tDatasother['calory']['number']) ? '' : ($tDatasother['calory']['number'] = 0); isset($tDatasother['carotene']['number']) ? '' : ($tDatasother['carotene']['number'] = 0); isset($tDatas['carbohydrate']['number']) ? '' : ($tDatas['carbohydrate']['number'] = 0); isset($tDatas['phosphor']['number']) ? '' : ($tDatas['phosphor']['number'] = 0); isset($tDatas['kalium']['number']) ? '' : ($tDatas['kalium']['number'] = 0); isset($tDatas['natrium']['number']) ? '' : ($tDatas['natrium']['number'] = 0); isset($tDatas['protein']['number']) ? '' : ($tDatas['protein']['number'] = 0); foreach ($tList as $tRow) { $tDatasother['calcium']['number'] += round($tRow['calcium'] / 100 * $tRow['weight'], 2); $tDatasother['vitamin_a']['number'] += round($tRow['vitamin_a'] / 100 * $tRow['weight'], 2); $tDatasother['zinc']['number'] += round($tRow['zinc'] / 100 * $tRow['weight'], 2); $tDatasother['magnesium']['number'] += round($tRow['magnesium'] / 100 * $tRow['weight'], 2); $tDatasother['vitamin_c']['number'] += round($tRow['vitamin_c'] / 100 * $tRow['weight'], 2); $tDatasother['fiber_dietary']['number'] += round($tRow['fiber_dietary'] / 100 * $tRow['weight'], 2); $tDatasother['selenium']['number'] += round($tRow['selenium'] / 100 * $tRow['weight'], 2); $tDatasother['copper']['number'] += round($tRow['copper'] / 100 * $tRow['weight'], 2); $tDatasother['fat']['number'] += round($tRow['fat'] / 100 * $tRow['weight'], 2); $tDatasother['niacin']['number'] += round($tRow['niacin'] / 100 * $tRow['weight'], 2); $tDatasother['vitamin_e']['number'] += round($tRow['vitamin_e'] / 100 * $tRow['weight'], 2); $tDatasother['manganese']['number'] += round($tRow['manganese'] / 100 * $tRow['weight'], 2); $tDatasother['cholesterol']['number'] += round($tRow['cholesterol'] / 100 * $tRow['weight'], 2); $tDatasother['iron']['number'] += round($tRow['iron'] / 100 * $tRow['weight'], 2); $tDatasother['thiamine']['number'] += round($tRow['thiamine'] / 100 * $tRow['weight'], 2); $tDatasother['lactoflavin']['number'] += round($tRow['lactoflavin'] / 100 * $tRow['weight'], 2); $tDatasother['calory']['number'] += round($tRow['calory'] / 100 * $tRow['weight'], 2); $tDatasother['carotene']['number'] += round($tRow['carotene'] / 100 * $tRow['weight'], 2); $tDatas['carbohydrate']['number'] += round($tRow['carbohydrate'] / 100 * $tRow['weight'], 2); #碳水化合物 $tDatas['phosphor']['number'] += round($tRow['phosphor'] / 100 * $tRow['weight'] / 1000, 2); #磷 #$tDatas['kalium']['number'] += round(($tRow['kalium']/100)*$tRow['weight']/1000,2);#钾 $tDatas['natrium']['number'] += round($tRow['natrium'] / 100 * $tRow['weight'] / 1000, 2); #钠 $tDatas['protein']['number'] += round($tRow['protein'] / 100 * $tRow['weight'], 2); #蛋白质 } unset($tList); #干体重 $tDWLMO = new DryweightlogModel(); $tDWLRow = $tDWLMO->field('weight')->where('uid = ' . $this->tUid . ' and date = \'' . $pDate . '\'')->fRow(); if (!count($tDWLRow)) { Tool_Fnc::ajaxMsg('', 1); } #应摄取 #蛋白质 $tArr = $tFMO->diet('protein', $tDWLRow['weight']); $tDatas['protein']['total'] = implode('-', $tArr); $tSurplus = $tArr['end'] - $tDatas['protein']['number']; $tDatas['protein']['surplus'] = $tSurplus <= 0 ? 0 : $tSurplus; #碳水化合物 $tArr = $tFMO->diet('carbohydrate', $tDWLRow['weight']); $tDatas['carbohydrate']['total'] = implode('-', $tArr); $tSurplus = $tArr['end'] - $tDatas['carbohydrate']['number']; $tDatas['carbohydrate']['surplus'] = $tSurplus <= 0 ? 0 : $tSurplus; #钠 $tArr = $tFMO->diet('natrium'); $tDatas['natrium']['total'] = implode('-', $tArr); $tSurplus = $tArr['end'] - $tDatas['natrium']['number']; $tDatas['natrium']['surplus'] = $tSurplus <= 0 ? 0 : $tSurplus; #磷 $tArr = $tFMO->diet('phosphor'); $tDatas['phosphor']['total'] = implode('-', $tArr); $tSurplus = $tArr['end'] - $tDatas['phosphor']['number']; $tDatas['phosphor']['surplus'] = $tSurplus <= 0 ? 0 : $tSurplus; #营养摄入评判 #蛋白质 $tDatas['protein']['status'] = $tFMO->diet_status('protein', $tDatas['protein']['number'], $tDWLRow['weight']); #碳水化合物 $tDatas['carbohydrate']['status'] = $tFMO->diet_status('carbohydrate', $tDatas['carbohydrate']['number'], $tDWLRow['weight']); #钠 $tDatas['natrium']['status'] = $tFMO->diet_status('natrium', $tDatas['natrium']['number']); #磷 $tDatas['phosphor']['status'] = $tFMO->diet_status('phosphor', $tDatas['phosphor']['number']); #控钾单独处理 $tUMO = new UserModel(); $tODDMO = new OrdinarydialysisdateModel(); $tBSDMO = new BqeschedulingdetailModel(); $tURow = $tUMO->field('user_type')->where('id = ' . $this->tUid)->fRow(); $tStart = $pDate; $tEnd = $pDate; if ($tURow['user_type'] == 0) { #非白求恩 $tODDRow = $tODDMO->field('date')->where('uid = \'' . $this->tUid . '\' and date < \'' . $pDate . '\'')->order('date desc')->limit('1')->fRow(); if (!empty($tODDRow['date'])) { $tStart = date('Y-m-d', strtotime($tODDRow['date']) + 86400); } } else { #白求恩 $tBSDRow = $tBSDMO->field('scheduling_date')->where('uid = \'' . $this->tUid . '\' and scheduling_date < \'' . $pDate . '\'')->order('scheduling_date desc')->limit('1')->fRow(); if (!empty($tBSDRow['scheduling_date'])) { $tStart = date('Y-m-d', strtotime($tBSDRow['scheduling_date']) + 86400); } } $tSql = 'select fid,unit,amount,weight,kalium from (select fid,unit,amount,weight from ' . $tFAMO->table . ' where uid = ' . $this->tUid . ' and created >=' . strtotime($tStart) . ' and created <=' . strtotime($tEnd . ' 23:59:59') . ') fa, ' . $tFMO->table . ' f where fa.fid = f.id'; $tList = $tFMO->query($tSql); foreach ($tList as $tRow) { $tDatas['kalium']['number'] += round($tRow['kalium'] / 100 * $tRow['weight'] / 1000, 2); #钾 } #钾 $tArr = $tFMO->diet('kalium'); #$tDatas['kalium']['total'] = implode('-',$tArr); $tDatas['kalium']['total'] = 10; $tSurplus = $tArr['end'] - $tDatas['kalium']['number']; $tDatas['kalium']['surplus'] = $tSurplus <= 0 ? 0 : $tSurplus; $tDatas['kalium']['status'] = $tFMO->diet_status('kalium', $tDatas['kalium']['number']); Tool_Fnc::ajaxMsg('', 1, array('main' => $tDatas, 'other' => $tDatasother)); exit; }
public function indexAction() { $p = $_REQUEST; if (!count($p)) { Tool_Fnc::ajaxMsg('参数错误'); } $pPhone = empty($p['phone']) ? '' : trim($p['phone']); if (!Tool_Validate::mo($pPhone)) { Tool_Fnc::ajaxMsg('手机号不正确'); } //判断手机号是否是白求恩 $tBUserInfo = Oci_User::isPhone($pPhone); if (empty($tBUserInfo)) { Tool_Fnc::ajaxMsg('非白求恩用户,下一步完善必须资料', 1, array('user_type' => 0)); } $pPassword = empty($p['ptxt']) ? '' : trim($p['ptxt']); #客户端发送的必须是md5的 密码 $pCode = empty($p['code']) ? '0' : trim($p['code']); $pDid = empty($p['did']) ? '' : trim($p['did']); $tTime = time(); if (empty($pPassword)) { Tool_Fnc::ajaxMsg('密码不能为空'); } if (empty($pCode)) { Tool_Fnc::ajaxMsg('验证码不能为空'); } if (!Tool_Validate::integer($pCode)) { Tool_Fnc::ajaxMsg('验证码格式错误'); } if (strlen($pPassword) != 32) { Tool_Fnc::ajaxMsg('接口发送的必须是密文密码'); } if (empty($pDid) || !Tool_Validate::az09($pDid)) { Tool_Fnc::ajaxMsg('did error'); } $tUMO = new UserModel(); $tUMO->begin(); $tRow = $tUMO->field('count(0) c')->where('phone = \'' . $pPhone . '\'')->fRow(); if (!empty($tRow['c'])) { Tool_Fnc::ajaxMsg('该手机已被他人使用,请重新输入'); } $tKey = Tool_Fnc::newrand(4); $tMd5str = Tool_Fnc::markmd5($pPassword, $tKey); $tCodeMO = new PhonecodeModel(); $tCodeCRow = $tCodeMO->check($pPhone, 1, $pCode); if ($tCodeCRow['status'] == 0) { Tool_Fnc::ajaxMsg($tCodeCRow['msg']); } $tData = array('phone' => $pPhone, 'reg_ip' => Tool_Fnc::realip(), "passwd" => $tMd5str, "reg_time" => $tTime, 'private_key' => $tKey, 'reg_did' => $pDid, 'user_type' => 1); if (!($tID = $tUMO->insert($tData))) { $tUMO->back(); Tool_Fnc::ajaxMsg('错误异常 001'); } //did入库 $tUDMO = new UserdidModel(); $tUDRow = $tUDMO->field('count(0) c')->where('uid = ' . $tID . ' and did = \'' . $pDid . '\'')->fRow(); if (empty($tUDRow['c'])) { $tData = array('uid' => $tID, 'did' => $pDid, 'created' => $tTime, 'ip' => Tool_Fnc::realip()); if (!$tUDMO->insert($tData)) { $tUMO->back(); Tool_Fnc::ajaxMsg('错误异常 002'); } } $tTokenarr = $this->creattoken($tID); //获取数据 $tSex = $tBUserInfo['SEX'] == '男' ? 1 : 0; $tPatientId = $tBUserInfo['PATIENT_ID']; //提取干体重 $tDryWeight = Oci_User::getDryWeight($tPatientId); $tDatas = array('id' => $tID, 'nickname' => $tBUserInfo['NAME'], 'sex' => $tSex, 'dry_weight' => $tDryWeight['BODY_WEIGHT'], 'date_of_birth' => $tBUserInfo['DATE_OF_BIRTH'], 'headimg' => $tBUserInfo['PHOTO']); if (!$tUMO->update($tDatas)) { $tUMO->back(); Tool_Fnc::ajaxMsg('错误异常 003'); } //新建健康档案 $tUserAssessment = Oci_User::getAssessment($tPatientId); $tUserAssessment['uid'] = $tID; $tUserAssessment['name'] = $tBUserInfo['NAME']; //his系统数据更新 $tCMO = new CenterModel(); $tCRow = $tCMO->field('id,name')->where(' center_id = \'' . $tBUserInfo['CENTER_ID'] . '\'')->fRow(); if (!empty($tCRow['id'])) { $tUserAssessment['medical_id'] = $tCRow['id']; //用户透析中心字段更新 $tUMedicalData = array('id' => $tID, 'center_id' => $tCRow['id'], 'medical_addr' => $tCRow['name']); if (!$tUMO->update($tUMedicalData)) { $tUMO->back(); Tool_Fnc::ajaxMsg('错误异常 003'); } } else { $tCenterdict = Oci_User::getCenterdict($tBUserInfo['CENTER_ID']); $tCData = array('center_id' => $tCenterdict['CENTER_ID'], 'center_code' => $tCenterdict['CENTER_CODE'], 'name' => $tCenterdict['CENTER_NAME'], 'position' => $tCenterdict['POSITION'], 'created' => $tTime); if (!($tUserAssessment['medical_id'] = $tCMO->insert($tCData))) { $tUMO->back(); Tool_Fnc::ajaxMsg('错误异常 008'); } //用户透析中心字段更新 $tUMedicalData = array('id' => $tID, 'center_id' => $tUserAssessment['medical_id'], 'medical_addr' => $tCenterdict['CENTER_NAME']); if (!$tUMO->update($tUMedicalData)) { $tUMO->back(); Tool_Fnc::ajaxMsg('错误异常 003'); } } //健康档案 $tUA = new UserassessmentModel(); foreach ($tUserAssessment as $k => $v) { $tUserAssessmentData[strtolower($k)] = $v; } $tUserAssessmentData['created'] = $tTime; //添加透析方式默认值 $tUserAssessmentData['method'] = 1; if (!$tUA->insert($tUserAssessmentData)) { $tUMO->back(); Tool_Fnc::ajaxMsg('错误异常 004'); } //干重记录表数据更新 $tDWMO = new DryweightlogModel(); /*$tDryWeightLog = array( 'uid' => $tID, 'weight' => $tDryWeight['BODY_WEIGHT'], 'date' => $tDryWeight['TREATE_DATE'], 'month' => date('Y-m',strtotime($tDryWeight['TREATE_DATE'])), 'year' => date('Y',strtotime($tDryWeight['TREATE_DATE'])), 'patient_id' => $tPatientId, 'created' => time(), );*/ $tSql = 'update ' . $tDWMO->table . ' set uid=' . $tID . ' where patient_id = \'' . $tPatientId . '\''; if (!$tDWMO->exec($tSql)) { $tUMO->back(); Tool_Fnc::ajaxMsg('错误异常 005'); } #更新白求恩排班表 $tSDMO = new BqeschedulingdetailModel(); $tSql = 'update ' . $tSDMO->table . ' set uid = ' . $tID . ' where patient_id = \'' . $tPatientId . '\''; if (!$tSDMO->exec($tSql)) { $tUMO->back(); Tool_Fnc::ajaxMsg('错误异常 006'); } #透析 - 治疗单主记录 $tTRMO = new BqetreatmentrecordModel(); $tSql = 'update ' . $tTRMO->table . ' set uid = ' . $tID . ' where patient_id = \'' . $tPatientId . '\''; if (!$tTRMO->exec($tSql)) { $tUMO->back(); Tool_Fnc::ajaxMsg('错误异常 007'); } $tUMO->commit(); //匿名转实名 $tUMO->incognito_real($pDid, $tID); $tTokenarr = array_merge($tTokenarr, array('user_type' => 1)); Tool_Fnc::ajaxMsg("注册成功,白求恩用户", 1, $tTokenarr); //注册成功返回token }
public function indexAction() { $tTime = time(); $tH = date('H', $tTime); $tMO = new BqeschedulingdetailModel(); $tUMO = new UserModel(); $tUDMO = new UserdidModel(); $tUAMO = new UserassessmentModel(); $tCMO = new CenterModel(); $tRedis = Cache_Redis::instance(); echo '<pre>'; if ($tH >= 7 && $tH <= 11) { #今日提醒 $tDatas = $tMO->field('uid,time_code')->where('scheduling_date = \'' . date('Y-m-d', $tTime) . '\' and time_code in(2,3) and uid <> 0')->fList(); foreach ($tDatas as $tRow) { #透析中心信息 $tUARow = $tUAMO->field('medical_id')->where('uid = ' . $tRow['uid'])->fRow(); if (!count($tUARow)) { continue; } $tCRow = $tCMO->field('today_weather,name')->where('id = ' . $tUARow['medical_id'])->fRow(); if (!count($tCRow)) { continue; } $tTitle = '透析提醒'; $tTitle = '透析提醒'; $tTimecodestr = $tRow['time_code'] == 2 ? '下午' : '晚上'; $tTpl_val = '#timecodestr#=今日' . $tTimecodestr . '&#name#=' . $tCRow['name'] . '&#weather#=今日天气' . $tCRow['today_weather']; $tContent = '您#timecodestr#在#name#透析,请准时参加,祝透析顺利。#weather#'; #用户信息 $tURow = $tUMO->field('phone')->where('id = ' . $tRow['uid'])->fRow(); if (!count($tURow)) { continue; } $tRedis->lpush('dakang_sms', serialize(array('content' => $tContent, 'phone' => $tURow['phone'], 'tpl_val' => $tTpl_val, 'type' => 'tx'))); #设备信息 $tSql = 'select cid,devicetoken from (select did from user_did where uid=' . $tRow['uid'] . ') ud,getui where ud.did = getui.did'; $tUDDatas = $tUDMO->query($tSql); $tTimecodestr = date('m月d日', $tTime) . $tTimecodestr; $tContent = '您' . $tTimecodestr . '在' . $tCRow['name'] . '透析,请准时参加,祝透析顺利。明日天气' . $tCRow['today_weather']; foreach ($tUDDatas as $tR) { $tRes = serialize(array_merge(array('title' => $tTitle, 'content' => $tContent, 'type' => 'tx', 'id' => ''), $tR)); $tRedis->lpush('dakang_getui', $tRes); } } } elseif ($tH >= 19 && $tH <= 21) { $tTimeCode = 1; #第二天上午 $tDatas = $tMO->field('uid')->where('scheduling_date = \'' . date('Y-m-d', $tTime + 86400) . '\' and time_code = ' . $tTimeCode)->fList(); foreach ($tDatas as $tRow) { #透析中心信息 $tUARow = $tUAMO->field('medical_id')->where('uid = ' . $tRow['uid'])->fRow(); if (!count($tUARow)) { continue; } $tCRow = $tCMO->field('tomorrow_weather,name')->where('id = ' . $tUARow['medical_id'])->fRow(); if (!count($tCRow)) { continue; } $tTitle = '透析提醒'; $tTimecodestr = '上午'; $tTpl_val = '#timecodestr#=明日' . $tTimecodestr . '&#name#=' . $tCRow['name'] . '&#weather#=明日天气' . $tCRow['tomorrow_weather']; $tContent = '您#timecodestr#在#name#透析,请准时参加,祝透析顺利。#weather#'; #用户信息 $tURow = $tUMO->field('phone')->where('id = ' . $tRow['uid'])->fRow(); if (!count($tURow)) { continue; } $tRedis->lpush('dakang_sms', serialize(array('content' => $tContent, 'phone' => $tURow['phone']))); #设备信息 $tSql = 'select cid,devicetoken from (select did from user_did where uid=' . $tRow['uid'] . ') ud,getui where ud.did = getui.did'; $tUDDatas = $tUDMO->query($tSql); $tTimecodestr = date('m月d日', $tTime + 86400) . '上午' . $tRow['time']; $tContent = '您' . $tTimecodestr . '在' . $tCRow['name'] . '透析,请准时参加,祝透析顺利。明日天气' . $tCRow['tomorrow_weather']; foreach ($tUDDatas as $tR) { $tRes = serialize(array_merge(array('title' => $tTitle, 'content' => $tContent, 'type' => 'tx', 'id' => ''), $tR)); $tRedis->lpush('dakang_getui', $tRes); } } } }