public function infoAction() { $p = $_REQUEST; $pUid = empty($p['id']) ? Tool_Fnc::ajaxMsg("异常错误 001") : intval($p['id']); $tUMO = new UserModel(); $tURow = $tUMO->field('headimg,nickname,phone,sex,dry_weight,date_of_birth,medical_addr')->where('id = ' . $pUid)->fRow(); $tUAMO = new UserassessmentModel(); $tUARow = $tUAMO->field('*')->where(' uid = ' . $pUid)->fRow(); $this->assign('tURow', $tURow); $this->assign('tUARow', $tUARow); }
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 infoAction() { $p = $_REQUEST; $pDate = empty($p['date']) ? '' : trim($p['date']); if (!empty($pDate) && !Tool_Validate::is_date($pDate)) { Tool_Fnc::ajaxMsg('日期格式不正确'); } $tTRMO = new BqetreatmentrecordModel(); if (empty($pDate)) { $tTRRow = $tTRMO->field('*')->where('uid = ' . $this->tUid)->order('treate_date desc')->limit(1)->fRow(); } else { $tTRRow = $tTRMO->field('*')->where('uid = ' . $this->tUid . ' and treate_date = \'' . $pDate . '\'')->fRow(); } if (!count($tTRRow)) { Tool_Fnc::ajaxMsg('', 1); } $tBDMO = new BqedoctorsModel(); $tBDRow = $tBDMO->field('name')->where('user_name = \'' . $tTRRow['treate_nurse'] . '\' and job = \'护士\'')->fRow(); if (!empty($tBDRow['name'])) { $tTRRow['treate_nurse'] = $tBDRow['name']; } $tBDRow = $tBDMO->field('name')->where('user_name = \'' . $tTRRow['doctor_user'] . '\' and job = \'医生\'')->fRow(); if (!empty($tBDRow['name'])) { $tTRRow['doctor_user'] = $tBDRow['name']; } $tBDRow = $tBDMO->field('name')->where('user_name = \'' . $tTRRow['puncture_nurse'] . '\' and job = \'护士\'')->fRow(); if (!empty($tBDRow['name'])) { $tTRRow['puncture_nurse'] = $tBDRow['name']; } //改造返回数据 unset($tTRRow['id']); unset($tTRRow['created']); unset($tTRRow['updated']); unset($tTRRow['uid']); #获取用户信息 $tUMO = new UserModel(); $tURow = $tUMO->field('sex,date_of_birth')->where('id = ' . $this->tUid)->fRow(); $tUAMO = new UserassessmentModel(); $tUARow = $tUAMO->field('name')->where('uid = ' . $this->tUid)->fRow(); $tTRRow['sex'] = empty($tURow['sex']) ? '女' : '男'; $tTRRow['date_of_birth'] = empty($tURow['date_of_birth']) || $tURow['date_of_birth'] == '0000-00-00' ? '未知' : Tool_Fnc::age($tURow['date_of_birth'], $tTRRow['treate_date']); $tTRRow['name'] = empty($tUARow['name']) ? '未知' : $tUARow['name']; $pDate = $tTRRow['treate_date']; #前一天透析日期 $tRow = $tTRMO->field('treate_date')->where('uid = ' . $this->tUid . ' and treate_date < \'' . $pDate . '\'')->order('treate_date desc')->limit(1)->fRow(); $tBeforeDay = empty($tRow['treate_date']) ? '' : $tRow['treate_date']; #后一天透析日期 $tRow = $tTRMO->field('treate_date')->where('uid = ' . $this->tUid . ' and treate_date > \'' . $pDate . '\'')->order('treate_date asc')->limit(1)->fRow(); $tAfterDay = empty($tRow['treate_date']) ? '' : $tRow['treate_date']; Tool_Fnc::ajaxMsg('', 1, array_merge($tTRRow, array('before_day' => $tBeforeDay, 'after_day' => $tAfterDay))); }
public function indexAction() { echo '<pre>'; $tTime = time(); $tH = date('H', $tTime); $tWhere = ' and PUNCTURE_NURSE is not NULL'; if ($tH >= 22 && $tH <= 23) { $tWhere = ''; } $tTRMO = new BqetreatmentrecordModel(); $tUAMO = new UserassessmentModel(); $tDWLMO = new DryweightlogModel(); $tUMO = new UserModel(); $tOci = new Orm_Oci(); $tHSql = 'select patient_id,treatment_times,fluid_volume,dialyzer,dialysis_mach,volume_na,volume_ca,volume_hc,volume_quantity,vascular_access,body_weight,bodyweight_bef,bodyweight_increase,ultrafilt_quantity,ufr,treat_time,blood_quantity,first_agent,maitain,additional,total_quantity,t,p,r,bp1,bp2,actual_treat_time,bodyweight_after,actual_ultrafilt_quantity,t_after,p_after,bp1_after,bp2_after,treate_summary,puncture_nurse,treate_nurse,doctor_user,to_char(treate_date,\'YYYY-mm-dd\') treate_date,treate_mode,dfz,vein_puncture,artery_puncture,kidney_solidification,dialyze_allergy,takeoff_needle from treatment_record where to_char(TREATE_DATE,\'YYYY-mm-dd\') = \'' . date('Y-m-d', $tTime) . '\' ' . $tWhere; #$tHSql = 'select patient_id,treatment_times,fluid_volume,dialyzer,dialysis_mach,volume_na,volume_ca,volume_hc,volume_quantity,vascular_access,body_weight,bodyweight_bef,bodyweight_increase,ultrafilt_quantity,ufr,treat_time,blood_quantity,first_agent,maitain,additional,total_quantity,t,p,r,bp1,bp2,actual_treat_time,bodyweight_after,actual_ultrafilt_quantity,t_after,p_after,bp1_after,bp2_after,treate_summary,puncture_nurse,treate_nurse,doctor_user,to_char(treate_date,\'YYYY-mm-dd\') treate_date,treate_mode,dfz,vein_puncture,artery_puncture,kidney_solidification,dialyze_allergy,takeoff_needle from treatment_record where to_char(TREATE_DATE,\'YYYY-mm-dd\') between \'2015-10-08\' and \'2015-12-08\''; $tDatas = $tOci->getAll($tHSql); foreach ($tDatas as $tRow) { $tTRRow = $tTRMO->field('count(0) c')->where('patient_id = \'' . $tRow['PATIENT_ID'] . '\' and treate_date = \'' . $tRow['TREATE_DATE'] . '\'')->fRow(); if (!empty($tTRRow['c'])) { continue; } foreach ($tRow as $k => $v) { $k = strtolower($k); $tData[$k] = $v; } $tUARow = $tUAMO->field('uid')->where('patient_id = \'' . $tRow['PATIENT_ID'] . '\'')->fRow(); $tData['uid'] = empty($tUARow['uid']) ? 0 : $tUARow['uid']; echo $tTRMO->insert($tData); echo "\r\n"; if (empty($tRow['BODY_WEIGHT'])) { continue; } if (!empty($tUid) && date('Y-m-d', $tTime) == $tRow['TREATE_DATE']) { #用户存在 并且干体重记录日期是今日 的话更新用户信息表 $tData = array('id' => $tUid, 'dry_weight' => $tRow['BODY_WEIGHT']); $tUMO->update($tData); } $tDWLRow = $tDWLMO->field('id')->where('patient_id = \'' . $tRow['PATIENT_ID'] . '\' and date = \'' . $tRow['TREATE_DATE'] . '\'')->fRow(); if (!empty($tDWLRow['id'])) { $tData = array('id' => $tDWLRow['id'], 'weight' => $tRow['BODY_WEIGHT'], 'updated' => $tTime); $tDWLMO->update($tData); } else { #干体重log $tData = array('weight' => $tRow['BODY_WEIGHT'], 'created' => $tTime, 'date' => $tRow['TREATE_DATE'], 'month' => date('Y-m', strtotime($tRow['TREATE_DATE'])), 'year' => date('Y', strtotime($tRow['TREATE_DATE'])), 'patient_id' => $tRow['PATIENT_ID']); $tDWLMO->insert($tData); } } exit; }
public function indexAction() { $tTime = time(); $tH = date('H', $tTime); $tRedis = Cache_Redis::instance(); $tMO = new OrdinarydialysistimeModel(); $tODDMO = new OrdinarydialysisdateModel(); $tUMO = new UserModel(); $tUDMO = new UserdidModel(); $tUAMO = new UserassessmentModel(); $tCMO = new CenterModel(); if ($tH >= 7 && $tH <= 11) { #今日提醒 $tWeek = date('w', $tTime); $tDate = date('Y-m-d', $tTime); $tWhere = ' time_code in (2,3)'; $tDatas = $tMO->field('uid,time_code,time')->where($tWhere . ' and week like \'%' . $tWeek . '%\'')->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 = '透析提醒'; $tTimecodestr = $tRow['time_code'] == 2 ? '下午' : '晚上'; $tTimecodestr .= $tRow['time']; $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); } $tODDRow = $tODDMO->field('count(0) c')->where('uid = ' . $tRow['uid'] . ' and date = \'' . $tDate . '\'')->fRow(); if (!empty($tODDRow['c'])) { continue; } #添加透析日期 $tData = array('date' => $tDate, 'uid' => $tRow['uid'], 'time_code' => $tRow['time_code'], 'created' => $tTime); $tODDMO->insert($tData); } } elseif ($tH >= 13 && $tH <= 21) { #第二天上午 $tWeek = date('w', $tTime + 86400); $tDate = date('Y-m-d', $tTime + 86400); $tWhere = ' time_code = 1'; $tDatas = $tMO->field('uid,time_code,time')->where($tWhere . ' and week like \'%' . $tWeek . '%\'')->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 = '上午' . $tRow['time']; $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'], '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 + 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); } #添加透析日期 $tODDRow = $tODDMO->field('count(0) c')->where('uid = ' . $tRow['uid'] . ' and date = \'' . $tDate . '\'')->fRow(); if (!empty($tODDRow['c'])) { continue; } $tData = array('date' => $tDate, 'uid' => $tRow['uid'], 'time_code' => $tRow['time_code'], 'created' => $tTime); $tODDMO->insert($tData); } } exit; }
public function listAction() { $p = $_REQUEST; $tUAMO = new UserassessmentModel(); $tRow = $tUAMO->field('*')->where(' uid = ' . $this->tUid)->fRow(); $tRow['medical_date_01'] = empty($tRow['medical_date_01']) ? '0000-00' : substr($tRow['medical_date_01'], 0, strlen($tRow['medical_date_01']) - 3); $tRow['medical_date_02'] = empty($tRow['medical_date_02']) ? '0000-00' : substr($tRow['medical_date_02'], 0, strlen($tRow['medical_date_02']) - 3); $tRow['medical_date_03'] = empty($tRow['medical_date_03']) ? '0000-00' : substr($tRow['medical_date_03'], 0, strlen($tRow['medical_date_03']) - 3); $tRow['medical_date_04'] = empty($tRow['medical_date_04']) ? '0000-00' : substr($tRow['medical_date_04'], 0, strlen($tRow['medical_date_04']) - 3); $tCDMO = new CenterModel(); $tCRow = $tCDMO->field('provinces,cities,name')->where(' id = ' . $tRow['medical_id'])->fRow(); $tRow['provinces'] = empty($tCRow['provinces']) ? '' : $tCRow['provinces']; $tRow['cities'] = empty($tCRow['cities']) ? '' : $tCRow['cities']; $tRow['medical_addr'] = empty($tCRow['name']) ? '' : $tCRow['name']; $tODTMO = new OrdinarydialysistimeModel(); $tODTRow = $tODTMO->field('time,week')->where(' uid =' . $this->tUid)->fRow(); $tRow['time'] = empty($tODTRow['time']) ? '' : $tODTRow['time']; $tRow['week'] = empty($tODTRow['week']) ? '' : $tODTRow['week']; Tool_Fnc::ajaxMsg('', 1, $tRow); }
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); } } } }
public function infoAction() { $tMO = new UserModel(); $tRow = $tMO->field('headimg,phone,sex,dry_weight,date_of_birth')->where('id = ' . $this->tUid)->fRow(); if (!count($tRow)) { Tool_Fnc::ajaxMsg('获取信息失败'); } $tUAMO = new UserassessmentModel(); $tARow = $tUAMO->field('name,medical_id')->where(' uid = ' . $this->tUid)->fRow(); $tCMO = new CenterModel(); $tCRow = $tCMO->field('name')->where(' id = ' . $tARow['medical_id'])->fRow(); $tODTMO = new OrdinarydialysistimeModel(); $tODTRow = $tODTMO->field('time,week,time_code')->where(' uid = ' . $this->tUid)->fRow(); unset($tARow['medical_id']); $tRow = array_merge($tRow, $tARow); if (!empty($tRow['headimg']) && !Tool_Validate::url($tRow['headimg'])) { $tRow['headimg'] = Yaf_Registry::get("config")->web->url->img . $tRow['headimg']; } Tool_Fnc::ajaxMsg('', 1, array_merge($tRow, array('medical_addr' => $tCRow['name'], 'assess_time' => $tODTRow))); }