コード例 #1
0
ファイル: Assessment.php プロジェクト: tanqinwang/test_own
 public function indexAction()
 {
     $p = $_REQUEST;
     //判断用户是否为白求恩用户
     $tUMO = new UserModel();
     $tURow = $tUMO->field('user_type')->where(' id = ' . $this->tUid)->fRow();
     if (empty($tURow) || $tURow['user_type'] == 1) {
         Tool_Fnc::ajaxMsg('操作错误');
     }
     $tData = array();
     $pPatientId = !isset($p['patient_id']) ? '' : ($tData['patient_id'] = Tool_Fnc::safe_string($p['patient_id']));
     $pInpNo = !isset($p['inp_no']) ? '' : ($tData['inp_no'] = Tool_Fnc::safe_string($p['inp_no']));
     $pMedicalDate01 = !isset($p['medical_date_01']) ? '' : ($tData['medical_date_01'] = Tool_Fnc::safe_string($p['medical_date_01'] . '-01'));
     $pMedicalDate02 = !isset($p['medical_date_02']) ? '' : ($tData['medical_date_02'] = Tool_Fnc::safe_string($p['medical_date_02'] . '-01'));
     $pMedicalDate03 = !isset($p['medical_date_03']) ? '' : ($tData['medical_date_03'] = Tool_Fnc::safe_string($p['medical_date_03'] . '-01'));
     $pMedicalDate04 = !isset($p['medical_date_04']) ? '' : ($tData['medical_date_04'] = Tool_Fnc::safe_string($p['medical_date_04'] . '-01'));
     $pPresent01 = !isset($p['present_01']) ? '' : ($tData['present_01'] = Tool_Fnc::safe_string($p['present_01']));
     $pPresent02 = !isset($p['present_02']) ? '' : ($tData['present_02'] = Tool_Fnc::safe_string($p['present_02']));
     $pPresent03 = !isset($p['present_03']) ? '' : ($tData['present_03'] = Tool_Fnc::safe_string($p['present_03']));
     $pPresent04 = !isset($p['present_04']) ? '' : ($tData['present_04'] = Tool_Fnc::safe_string($p['present_04']));
     $pPresent05 = !isset($p['present_05']) ? '' : ($tData['present_05'] = Tool_Fnc::safe_string($p['present_05']));
     $pPresent06 = !isset($p['present_06']) ? '' : ($tData['present_06'] = Tool_Fnc::safe_string($p['present_06']));
     $pPresent07 = !isset($p['present_07']) ? '' : ($tData['present_07'] = Tool_Fnc::safe_string($p['present_07']));
     $pPresent08 = !isset($p['present_08']) ? '' : ($tData['present_08'] = Tool_Fnc::safe_string($p['present_08']));
     $pPresent09 = !isset($p['present_09']) ? '' : ($tData['present_09'] = Tool_Fnc::safe_string($p['present_09']));
     $pPresent10 = !isset($p['present_10']) ? '' : ($tData['present_10'] = Tool_Fnc::safe_string($p['present_10']));
     $pPresent11 = !isset($p['present_11']) ? '' : ($tData['present_11'] = Tool_Fnc::safe_string($p['present_11']));
     $pPresent12 = !isset($p['present_12']) ? '' : ($tData['present_12'] = Tool_Fnc::safe_string($p['present_12']));
     $pPresent13 = !isset($p['present_13']) ? '' : ($tData['present_13'] = Tool_Fnc::safe_string($p['present_13']));
     $pPresent14 = !isset($p['present_14']) ? '' : ($tData['present_14'] = Tool_Fnc::safe_string($p['present_14']));
     $pPresent15 = !isset($p['present_15']) ? '' : ($tData['present_15'] = Tool_Fnc::safe_string($p['present_15']));
     $pPresent16 = !isset($p['present_16']) ? '' : ($tData['present_16'] = Tool_Fnc::safe_string($p['present_16']));
     $pPresent17 = !isset($p['present_17']) ? '' : ($tData['present_17'] = Tool_Fnc::safe_string($p['present_17']));
     $pPresent18 = !isset($p['present_18']) ? '' : ($tData['present_18'] = Tool_Fnc::safe_string($p['present_18']));
     $pPresent19 = !isset($p['present_19']) ? '' : ($tData['present_19'] = Tool_Fnc::safe_string($p['present_19']));
     $pPresent20 = !isset($p['present_20']) ? '' : ($tData['present_20'] = Tool_Fnc::safe_string($p['present_20']));
     $pPresent21 = !isset($p['present_21']) ? '' : ($tData['present_21'] = Tool_Fnc::safe_string($p['present_21']));
     $pPresent22 = !isset($p['present_22']) ? '' : ($tData['present_22'] = Tool_Fnc::safe_string($p['present_22']));
     $pPresent23 = !isset($p['present_23']) ? '' : ($tData['present_23'] = Tool_Fnc::safe_string($p['present_23']));
     $pPresent24 = !isset($p['present_24']) ? '' : ($tData['present_24'] = Tool_Fnc::safe_string($p['present_24']));
     $pComplication01 = !isset($p['complication_01']) ? '' : ($tData['complication_01'] = Tool_Fnc::safe_string($p['complication_01']));
     $pComplication02 = !isset($p['complication_02']) ? '' : ($tData['complication_02'] = Tool_Fnc::safe_string($p['complication_02']));
     $pComplication03 = !isset($p['complication_03']) ? '' : ($tData['complication_03'] = Tool_Fnc::safe_string($p['complication_03']));
     $pComplication04 = !isset($p['complication_04']) ? '' : ($tData['complication_04'] = Tool_Fnc::safe_string($p['complication_04']));
     $pComplication05 = !isset($p['complication_05']) ? '' : ($tData['complication_05'] = Tool_Fnc::safe_string($p['complication_05']));
     $pComplication06 = !isset($p['complication_06']) ? '' : ($tData['complication_06'] = Tool_Fnc::safe_string($p['complication_06']));
     $pMedPast011 = !isset($p['med_past_011']) ? '' : ($tData['med_past_011'] = Tool_Fnc::safe_string($p['med_past_011']));
     $pMedPast012 = !isset($p['med_past_012']) ? '' : ($tData['med_past_012'] = Tool_Fnc::safe_string($p['med_past_012']));
     $pMedPast013 = !isset($p['med_past_013']) ? '' : ($tData['med_past_013'] = Tool_Fnc::safe_string($p['med_past_013']));
     $pMedPast021 = !isset($p['med_past_021']) ? '' : ($tData['med_past_021'] = Tool_Fnc::safe_string($p['med_past_021']));
     $pMedPast022 = !isset($p['med_past_022']) ? '' : ($tData['med_past_022'] = Tool_Fnc::safe_string($p['med_past_022']));
     $pMedPast031 = !isset($p['med_past_031']) ? '' : ($tData['med_past_031'] = Tool_Fnc::safe_string($p['med_past_031']));
     $pMedPast032 = !isset($p['med_past_032']) ? '' : ($tData['med_past_032'] = Tool_Fnc::safe_string($p['med_past_032']));
     $pMedPast033 = !isset($p['med_past_033']) ? '' : ($tData['med_past_033'] = Tool_Fnc::safe_string($p['med_past_033']));
     $pMedPast034 = !isset($p['med_past_034']) ? '' : ($tData['med_past_034'] = Tool_Fnc::safe_string($p['med_past_034']));
     $pMedPast035 = !isset($p['med_past_035']) ? '' : ($tData['med_past_035'] = Tool_Fnc::safe_string($p['med_past_035']));
     $pMedPast036 = !isset($p['med_past_036']) ? '' : ($tData['med_past_036'] = Tool_Fnc::safe_string($p['med_past_036']));
     $pMedPast037 = !isset($p['med_past_037']) ? '' : ($tData['med_past_037'] = Tool_Fnc::safe_string($p['med_past_037']));
     $pMedPast041 = !isset($p['med_past_041']) ? '' : ($tData['med_past_041'] = Tool_Fnc::safe_string($p['med_past_041']));
     $pMedPast042 = !isset($p['med_past_042']) ? '' : ($tData['med_past_042'] = Tool_Fnc::safe_string($p['med_past_042']));
     $pMedPast043 = !isset($p['med_past_043']) ? '' : ($tData['med_past_043'] = Tool_Fnc::safe_string($p['med_past_043']));
     $pMedPast044 = !isset($p['med_past_044']) ? '' : ($tData['med_past_044'] = Tool_Fnc::safe_string($p['med_past_044']));
     $pMedPast045 = !isset($p['med_past_045']) ? '' : ($tData['med_past_045'] = Tool_Fnc::safe_string($p['med_past_045']));
     $pMedPast046 = !isset($p['med_past_046']) ? '' : ($tData['med_past_046'] = Tool_Fnc::safe_string($p['med_past_046']));
     $pMedPast05 = !isset($p['med_past_05']) ? '' : ($tData['med_past_05'] = Tool_Fnc::safe_string($p['med_past_05']));
     $pMedPast06 = !isset($p['med_past_06']) ? '' : ($tData['med_past_06'] = Tool_Fnc::safe_string($p['med_past_06']));
     $pMedPast07 = !isset($p['med_past_07']) ? '' : ($tData['med_past_07'] = Tool_Fnc::safe_string($p['med_past_07']));
     $pMedPast08 = !isset($p['med_past_08']) ? '' : ($tData['med_past_08'] = Tool_Fnc::safe_string($p['med_past_08']));
     $pMedPast09 = !isset($p['med_past_09']) ? '' : ($tData['med_past_09'] = Tool_Fnc::safe_string($p['med_past_09']));
     $pMedPast10 = !isset($p['med_past_10']) ? '' : ($tData['med_past_10'] = Tool_Fnc::safe_string($p['med_past_10']));
     $pMedPast11 = !isset($p['med_past_11']) ? '' : ($tData['med_past_11'] = Tool_Fnc::safe_string($p['med_past_11']));
     $pMedPast12 = !isset($p['med_past_12']) ? '' : ($tData['med_past_12'] = Tool_Fnc::safe_string($p['med_past_12']));
     $pMedPast13 = !isset($p['med_past_13']) ? '' : ($tData['med_past_13'] = Tool_Fnc::safe_string($p['med_past_13']));
     $pBodyHeight = !isset($p['body_height']) ? '' : ($tData['body_height'] = floatval($p['body_height']));
     $pDialysisNo = !isset($p['dialysis_no']) ? '' : ($tData['dialysis_no'] = floatval($p['dialysis_no']));
     $pAnticoagulation = !isset($p['anticoagulation']) ? '' : ($tData['anticoagulation'] = Tool_Fnc::safe_string($p['anticoagulation']));
     $pIfIn = !isset($p['if_in']) ? '' : ($tData['if_in'] = Tool_Fnc::safe_string($p['if_in']));
     $pWeeks = !isset($p['weeks']) ? '' : ($tData['weeks'] = floatval($p['weeks']));
     $pPresent101 = !isset($p['present_10_1']) ? '' : ($tData['present_10_1'] = Tool_Fnc::safe_string($p['present_10_1']));
     $pPresent041 = !isset($p['present_04_1']) ? '' : ($tData['present_04_1'] = Tool_Fnc::safe_string($p['present_04_1']));
     $pPresent201 = !isset($p['present_20_1']) ? '' : ($tData['present_20_1'] = Tool_Fnc::safe_string($p['present_20_1']));
     $pPresent241 = !isset($p['present_24_1']) ? '' : ($tData['present_24_1'] = Tool_Fnc::safe_string($p['present_24_1']));
     $pMedPast051 = !isset($p['med_past_05_1']) ? '' : ($tData['med_past_05_1'] = Tool_Fnc::safe_string($p['med_past_05_1']));
     $pMedPast061 = !isset($p['med_past_06_1']) ? '' : ($tData['med_past_06_1'] = Tool_Fnc::safe_string($p['med_past_06_1']));
     $pMedPast071 = !isset($p['med_past_07_1']) ? '' : ($tData['med_past_07_1'] = Tool_Fnc::safe_string($p['med_past_07_1']));
     $pMedPast081 = !isset($p['med_past_08_1']) ? '' : ($tData['med_past_08_1'] = Tool_Fnc::safe_string($p['med_past_08_1']));
     $pMedPast091 = !isset($p['med_past_09_1']) ? '' : ($tData['med_past_09_1'] = Tool_Fnc::safe_string($p['med_past_09_1']));
     $pMedPast101 = !isset($p['med_past_10_1']) ? '' : ($tData['med_past_10_1'] = Tool_Fnc::safe_string($p['med_past_10_1']));
     $pMedPast111 = !isset($p['med_past_11_1']) ? '' : ($tData['med_past_11_1'] = Tool_Fnc::safe_string($p['med_past_11_1']));
     $pMedPast121 = !isset($p['med_past_12_1']) ? '' : ($tData['med_past_12_1'] = Tool_Fnc::safe_string($p['med_past_12_1']));
     $pMedPast131 = !isset($p['med_past_13_1']) ? '' : ($tData['med_past_13_1'] = Tool_Fnc::safe_string($p['med_past_13_1']));
     $pMedPast102 = !isset($p['med_past_10_2']) ? '' : ($tData['med_past_10_2'] = Tool_Fnc::safe_string($p['med_past_10_2']));
     $pMethod = !isset($p['method']) ? '' : ($tData['method'] = intval($p['method']));
     $pMedicalType = !isset($p['medical_type']) ? '' : ($tData['medical_type'] = Tool_Fnc::safe_string($p['medical_type']));
     $pProvinces = !isset($p['provinces']) ? '' : ($tData['provinces'] = Tool_Fnc::safe_string($p['provinces']));
     $pCities = !isset($p['cities']) ? '' : ($tData['cities'] = Tool_Fnc::safe_string($p['cities']));
     $pMedicalAddr = !isset($p['medical_addr']) ? '' : ($tData['medical_addr'] = Tool_Fnc::safe_string($p['medical_addr']));
     $pName = !isset($p['name']) ? '' : ($tData['name'] = Tool_Fnc::safe_string($p['name']));
     $tTime = time();
     $pAssessTime = !isset($p['assess_time']) ? '' : ($tData['assess_time'] = Tool_Fnc::safe_string($p['assess_time']));
     $pAssessWeek = !isset($p['assess_week']) ? '' : ($tData['assess_week'] = Tool_Fnc::safe_string($p['assess_week']));
     $pAssesstimecode = !isset($p['assess_time_code']) ? '' : ($tData['assess_time_code'] = intval($p['assess_time_code']));
     //判断是否有数据
     if (!count($tData)) {
         Tool_Fnc::ajaxMsg('数据异常');
     }
     //更新用户表字段用户名
     if (isset($tData['name']) && !empty($tData['name'])) {
         $tUMO = new UserModel();
         $tUData = array('id' => $this->tUid, 'nickname' => $tData['name'], 'updated' => $tTime);
         if (!$tUMO->update($tUData)) {
             Tool_Fnc::ajaxMsg('更新失败');
         }
     }
     //先更新透析中心
     $tCMO = new CenterModel();
     $tCData = array();
     if (isset($tData['medical_addr']) && !empty($tData['medical_addr'])) {
         $tCData = array_merge($tCData, array('name' => $tData['medical_addr']));
     }
     if (isset($tData['provinces']) && !empty($tData['provinces'])) {
         $tCData = array_merge($tCData, array('provinces' => $tData['provinces']));
     }
     if (isset($tData['cities']) && !empty($tData['cities'])) {
         $tCData = array_merge($tCData, array('cities' => $tData['cities']));
     }
     if (!empty($tCData)) {
         $sql = "select id from {$tCMO->table} where name = '{$tData['medical_addr']}' and provinces = '{$tData['provinces']}' and cities ='{$tData['cities']}' and type = 0";
         $tCMOList = $tCMO->query($sql);
         if (empty($tCMOList[0]['id'])) {
             $tCData = array_merge($tCData, array('created' => $tTime));
             $tCData = array_merge($tCData, array('type' => 0));
             //获取天气
             $tWeatherCities = array('北京', '天津', '上海', '重庆');
             if (in_array($tCData['provinces'], $tWeatherCities)) {
                 $tWeatherCity = $tCData['provinces'];
             } else {
                 $tWeatherCity = $tCData['cities'];
             }
             $tWeather = Tool_Fnc::weather_juhe($tWeatherCity);
             $tCData['today_weather'] = $tWeather['today_weather'];
             $tCData['tomorrow_weather'] = $tWeather['tomorrow_weather'];
             if (!($tMedicalId = $tCMO->insert($tCData))) {
                 Tool_Fnc::ajaxMsg('插入失败');
             }
             $tUData = array('id' => $this->tUid, 'center_id' => $tMedicalId, 'medical_addr' => $tData['medical_addr'], 'updated' => $tTime);
         } else {
             $tUData = array('id' => $this->tUid, 'center_id' => $tCMOList[0]['id'], 'medical_addr' => $tData['medical_addr'], 'updated' => $tTime);
         }
         //更新用户表字段
         $tUMO = new UserModel();
         if (!$tUMO->update($tUData)) {
             Tool_Fnc::ajaxMsg('更新失败');
         }
     }
     //更新普通会员的透析时间
     $tODTMO = new OrdinarydialysistimeModel();
     $tODTData = array();
     if (isset($tData['assess_time'])) {
         $tData['assess_time'] = empty($tData['assess_time']) ? '' : Tool_Fnc::safe_string($tData['assess_time']);
         $tODTData = array_merge($tODTData, array('time' => Tool_Fnc::safe_string($tData['assess_time'])));
     }
     if (isset($tData['assess_week'])) {
         $tData['assess_week'] = empty($tData['assess_week']) ? '' : Tool_Fnc::safe_string($tData['assess_week']);
         $tODTData = array_merge($tODTData, array('week' => Tool_Fnc::safe_string($tData['assess_week'])));
     }
     if (isset($tData['assess_time_code'])) {
         $tData['assess_time_code'] = empty($tData['assess_time_code']) ? 0 : intval($tData['assess_time_code']);
         $tODTData = array_merge($tODTData, array('time_code' => intval($tData['assess_time_code'])));
     }
     if (!empty($tODTData)) {
         $tODTRow = $tODTMO->field('id')->where(' uid = ' . $this->tUid)->fRow();
         if (empty($tODTRow['id'])) {
             $tODTData = array_merge($tODTData, array('created' => $tTime));
             $tODTData = array_merge($tODTData, array('uid' => $this->tUid));
             if (!$tODTMO->insert($tODTData)) {
                 Tool_Fnc::ajaxMsg('插入失败');
             }
         } else {
             $tODTData = array_merge($tODTData, array('updated' => $tTime));
             $tODTData = array_merge($tODTData, array('id' => $tODTRow['id']));
             if (!$tODTMO->update($tODTData)) {
                 Tool_Fnc::ajaxMsg('更新失败');
             }
         }
     }
     //判断是更新还是插入健康档案
     $tUAMO = new UserassessmentModel();
     $tRow = $tUAMO->field('id,medical_id')->where(' uid = ' . $this->tUid)->fRow();
     $tData['uid'] = $this->tUid;
     $tRow['medical_id'] = empty($tRow['medical_id']) ? 0 : $tRow['medical_id'];
     $tData['medical_id'] = isset($tMedicalId) ? $tMedicalId : $tRow['medical_id'];
     if (empty($tRow['id'])) {
         $tData = array_merge($tData, array('created' => $tTime));
         if (!$tUAMO->insert($tData)) {
             Tool_Fnc::ajaxMsg('插入失败');
         }
     } else {
         $tData['id'] = $tRow['id'];
         $tData['updated'] = $tTime;
         if (!$tUAMO->update($tData)) {
             Tool_Fnc::ajaxMsg('更新失败');
         }
     }
     Tool_Fnc::ajaxMsg('数据操作成功', 1);
 }
コード例 #2
0
ファイル: User.php プロジェクト: tanqinwang/test_own
 public function edittimeAction()
 {
     $p = $_REQUEST;
     //判断用户是否为白求恩用户
     $tUMO = new UserModel();
     $tURow = $tUMO->field('user_type')->where(' id = ' . $this->tUid)->fRow();
     if ($tURow['user_type'] == 1) {
         Tool_Fnc::ajaxMsg('操作错误');
     }
     $pWeek = empty($p['week']) ? '' : Tool_Fnc::safe_string($p['week']);
     $pTime = empty($p['time']) ? '' : Tool_Fnc::safe_string($p['time']);
     $pTimecode = empty($p['time_code']) ? 0 : intval($p['time_code']);
     $tTime = time();
     $tData = array('week' => $pWeek, 'time' => $pTime, 'time_code' => $pTimecode);
     $tODTMO = new OrdinarydialysistimeModel();
     $tODTRow = $tODTMO->field('id')->where('uid = ' . $this->tUid)->fRow();
     if (!empty($tODTRow['id'])) {
         $tData['updated'] = $tTime;
         $tData['id'] = $tODTRow['id'];
         if (!$tODTMO->update($tData)) {
             Tool_Fnc::ajaxMsg('更新失败');
         }
     } else {
         $tData['created'] = $tTime;
         $tData['uid'] = $this->tUid;
         if (!$tODTMO->insert($tData)) {
             Tool_Fnc::ajaxMsg('插入失败');
         }
     }
     Tool_Fnc::ajaxMsg('', 1);
 }