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