Exemplo n.º 1
0
 public function actionUpdate($id)
 {
     $patient = $this->loadModel($id);
     $doctors = Doctor::model()->findAll();
     $medicalRecords = new MedicalRecord('search');
     $medicalRecords->unsetAttributes();
     $surgeryRecords = new SurgeryRecord('search');
     $surgeryRecords->unsetAttributes();
     if (isset($_GET['MedicalRecord'])) {
         $medicalRecords->attributes = $_GET['MedicalRecord'];
     }
     if (isset($_GET['SurgeryRecord'])) {
         $surgeryRecords->attributes = $_GET['SurgeryRecord'];
     }
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($patient);
     if (isset($_POST['Patient'])) {
         $patient->attributes = $_POST['Patient'];
         if ($patient->save()) {
             Yii::app()->user->setFlash('success', '儲存成功.');
             $this->redirect(array('update', 'id' => $patient->id));
         }
     }
     $this->render('update', array('patient' => $patient, 'doctors' => $doctors, 'medicalRecords' => $medicalRecords, 'surgeryRecords' => $surgeryRecords));
 }
 public function actionIndex()
 {
     $model = new SurgeryRecord('search');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['SurgeryRecord'])) {
         $model->attributes = $_GET['SurgeryRecord'];
     }
     $this->render('index', array('model' => $model));
 }
Exemplo n.º 3
0
 public function actionRecent()
 {
     $doctors = Doctor::model()->findAll();
     $recentOutpatients = new MedicalRecord('search');
     $recentOutpatients->unsetAttributes();
     if (isset($_GET['MedicalRecord'])) {
         $recentOutpatients->attributes = $_GET['MedicalRecord'];
     }
     $recentSurgeries = new SurgeryRecord('search');
     $recentSurgeries->unsetAttributes();
     if (isset($_GET['SurgeryRecord'])) {
         $recentSurgeries->attributes = $_GET['SurgeryRecord'];
     }
     $this->render('index', compact('recentOutpatients', 'recentSurgeries', 'doctors'));
 }
Exemplo n.º 4
0
 /**
  * 匯出手術記錄
  */
 public function actionSurgeryRecords()
 {
     $dataProvider = new SurgeryRecord('search');
     $dataProvider->unsetAttributes();
     if (isset($_GET['SurgeryRecord'])) {
         $dataProvider->attributes = $_GET['SurgeryRecord'];
         $surgeryRecords = SurgeryRecord::model()->findAll($dataProvider->search()->getCriteria());
         $fields = array('病歷號' => 'patientId', '姓名' => 'patientName', '手術日期' => 'date', '給付' => 'payType', '術前診斷' => 'icd', '術式' => 'surgical_methods', '3D' => 'three_dimensional', '矯正牙科醫師' => 'dentistName', '手術醫師' => 'plasticSurgeonName', '備註' => 'memo', '是否手術優先' => 'isSurgicalPriority', '是否院外牙科' => 'isOutsideDentist');
         $content = implode("\t", array_keys($fields)) . "\n";
         foreach ($surgeryRecords as $surgeryRecord) {
             foreach ($fields as $field) {
                 $content .= '"' . $surgeryRecord->{$field} . '"' . "\t";
             }
             $content .= "\n";
         }
         $this->_downloadExcel('手術記錄-' . date('Y-m-d-His'), $content);
     }
     exit;
 }