Beispiel #1
0
 static function getCenterdict($id)
 {
     $Oci = new Orm_Oci();
     $tSql = ' select CENTER_ID,CENTER_CODE,CENTER_NAME,POSITION from CENTER_DICT where CENTER_ID = \'' . $id . '\'';
     $tRow = $Oci->getRow($tSql);
     return $tRow;
 }
 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;
 }
Beispiel #3
0
 public function indexAction()
 {
     $tTime = time();
     $tMO = new BqedoctorsModel();
     $tRow = $tMO->field('emp_no')->order('emp_no desc')->limit('1')->fRow();
     $tEmpNo = empty($tRow['emp_no']) ? 0 : $tRow['emp_no'];
     $tOci = new Orm_Oci();
     $tSql = 'select emp_no,name,user_name,job,title from staff_dict where emp_no > ' . $tEmpNo;
     $tDatas = $tOci->getAll($tSql);
     foreach ($tDatas as $tRow) {
         $tData = array('emp_no' => $tRow['EMP_NO'], 'name' => $tRow['NAME'], 'user_name' => $tRow['USER_NAME'], 'job' => $tRow['JOB'], 'title' => $tRow['TITLE'], 'created' => $tTime);
         $tMO->insert($tData);
     }
 }
Beispiel #4
0
 public function indexAction()
 {
     $tTime = time();
     $tCMO = new CenterModel();
     $tCRow = $tCMO->field('center_id')->order('center_id desc')->limit('1')->fRow();
     $tCenterid = empty($tCRow['center_id']) ? 0 : $tCRow['center_id'];
     $tOci = new Orm_Oci();
     $tHSql = 'select * from center_dict where center_id > ' . $tCenterid;
     $tDatas = $tOci->getAll($tHSql);
     foreach ($tDatas as $tRow) {
         $tData = array('center_id' => $tRow['CENTER_ID'], 'center_code' => $tRow['CENTER_CODE'], 'name' => $tRow['CENTER_NAME'], 'position' => $tRow['POSITION'], 'created' => $tTime, 'type' => 1);
         $tCMO->insert($tData);
     }
     exit;
 }
 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;
 }