当前位置: 首页>>代码示例>>PHP>>正文


PHP Patient::search方法代码示例

本文整理汇总了PHP中Patient::search方法的典型用法代码示例。如果您正苦于以下问题:PHP Patient::search方法的具体用法?PHP Patient::search怎么用?PHP Patient::search使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Patient的用法示例。


在下文中一共展示了Patient::search方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: loadPatients

 /**
  * Display a listing of the resource.
  * Called loadPatients because the same controller shall be used for all other reports
  * @return Response
  */
 public function loadPatients()
 {
     $search = Input::get('search');
     $patients = Patient::search($search)->orderBy('id', 'DESC')->paginate(Config::get('kblis.page-items'));
     if (count($patients) == 0) {
         Session::flash('message', trans('messages.no-match'));
     }
     // Load the view and pass the patients
     return View::make('reports.patient.index')->with('patients', $patients)->withInput(Input::all());
 }
开发者ID:BaobabHealthTrust,项目名称:iBLIS,代码行数:15,代码来源:ReportController.php

示例2: testSearch_WithValidTerms_ReturnsExpectedResults

 /**
  * @dataProvider dataProvider_Search
  */
 public function testSearch_WithValidTerms_ReturnsExpectedResults($searchTerms, $numResults, $expectedKeys)
 {
     $patient = new Patient();
     $patient->setAttributes($searchTerms);
     $results = $patient->search($searchTerms);
     $data = $results->getData();
     $expectedResults = array();
     if (!empty($expectedKeys)) {
         foreach ($expectedKeys as $key) {
             $expectedResults[] = $this->patients($key);
         }
     }
     if (isset($data[0])) {
         $this->assertEquals($expectedResults, array('0' => $data[0]->getAttributes()));
     }
 }
开发者ID:openeyeswales,项目名称:OpenEyes,代码行数:19,代码来源:PatientTest.php

示例3: search

 /**
  * Searching for patients.
  * 
  * @param string $term search term
  */
 public function search($term)
 {
     $search_terms = $this->parseTerm($term);
     $model = new Patient();
     $model->hos_num = $search_terms['hos_num'];
     $model->nhs_num = $search_terms['nhs_num'];
     // Get the valuse from URL
     $currentPage = Yii::app()->request->getParam('Patient_page');
     $pageSize = Yii::app()->request->getParam('pageSize', 20);
     // if no GET param we try to fetch the value from the $criteria, default value 0 is none of them set
     $sortDir = Yii::app()->request->getParam('sort_dir', 0);
     $sortDir = $sortDir == 0 || $sortDir == 'asc' ? 'asc' : 'desc';
     $sortBy = Yii::app()->request->getParam('sort_by');
     switch ($sortBy) {
         case 0:
             $sortBy = 'hos_num*1';
             break;
         case 1:
             $sortBy = 'title';
             break;
         case 2:
             $sortBy = 'first_name';
             break;
         case 3:
             $sortBy = 'last_name';
             break;
         case 4:
             $sortBy = 'dob';
             break;
         case 5:
             $sortBy = 'gender';
             break;
         case 6:
             $sortBy = 'nhs_num*1';
             break;
         default:
             $sortBy = 'hos_num*1';
     }
     $patientCriteria = array('pageSize' => $pageSize, 'sortBy' => $sortBy, 'sortDir' => $sortDir, 'currentPage' => $currentPage, 'first_name' => CHtml::decode($search_terms['first_name']), 'last_name' => CHtml::decode($search_terms['last_name']));
     $dataProvider = $model->search($patientCriteria);
     return $dataProvider;
 }
开发者ID:openeyes,项目名称:openeyes,代码行数:47,代码来源:PatientSearch.php

示例4: getSearch

 /**
  * Perform a search on a model and return the results
  * (separate function for unit testing)
  *
  * @param array $data form data of search terms
  * @return CDataProvider
  */
 public function getSearch($data)
 {
     $model = new Patient();
     $model->attributes = $data;
     return $model->search();
 }
开发者ID:openeyeswales,项目名称:OpenEyes,代码行数:13,代码来源:PatientController.php

示例5: search

 /**
  * Return a Patients collection that meets the searched criteria as JSON.
  *
  * @return Response
  */
 public function search()
 {
     return Patient::search(Input::get('text'))->take(Config::get('kblis.limit-items'))->get()->toJson();
 }
开发者ID:BaobabHealthTrust,项目名称:iBLIS,代码行数:9,代码来源:PatientController.php

示例6: actionImport

 public function actionImport($importDir, $archiveDir, $errorDir, $dupDir, $interval = 'PT45M', $pasImport = false)
 {
     $this->importDir = $this->checkSeparator($importDir);
     $this->archiveDir = $this->checkSeparator($archiveDir);
     $this->errorDir = $this->checkSeparator($errorDir);
     $this->dupDir = $this->checkSeparator($dupDir);
     $this->interval = $interval;
     $fhirMarshal = Yii::app()->fhirMarshal;
     $eventType = EventType::model()->find('class_name=:class_name', array(':class_name' => 'OphInVisualfields'));
     if (!$eventType) {
         echo 'Cannot find OphInVisualfields event type, cannot continue' . PHP_EOL;
         die;
     }
     echo 'Processing FMES files...' . PHP_EOL;
     $filenames = glob($this->importDir . '/*.fmes');
     echo count($filenames) . " files to process\n";
     foreach ($filenames as $file) {
         try {
             $basename = basename($file);
             echo $basename . PHP_EOL;
             // First check the file has not already been imported:
             $field = file_get_contents($file);
             $fieldObject = $fhirMarshal->parseXml($field);
             if ($protected_file = ProtectedFile::model()->find('name=:name', array(':name' => $fieldObject->file_reference))) {
                 echo '- ProtectedFile exists (' . $protected_file->id . ')' . PHP_EOL;
                 $this->move($this->dupDir, $file);
                 continue;
             }
             // Extract the patient number
             $matches = array();
             preg_match('/__OE_PATIENT_ID_([0-9]*)__/', $field, $matches);
             if (count($matches) < 2) {
                 echo '- Failed to extract patient ID' . PHP_EOL;
                 $this->move($this->errorDir, $file);
                 continue;
             }
             $match = str_pad($matches[1], 7, '0', STR_PAD_LEFT);
             // Fetch the patient
             if ($pasImport) {
                 $model = new Patient(null);
                 $model->hos_num = $match;
                 $results = $model->search()->getData();
                 $patient = reset($results);
             } else {
                 $patient = Patient::model()->find('hos_num=:hos_num', array(':hos_num' => $match));
             }
             if (!$patient) {
                 echo "- Failed to find patient ({$match})" . PHP_EOL;
                 $this->move($this->errorDir, $file);
                 continue;
             }
             $pid = $patient->id;
             $field = preg_replace('/__OE_PATIENT_ID_([0-9]*)__/', $pid, $field);
             // Convert to measurement
             $resource_type = 'MeasurementVisualFieldHumphrey';
             $service = Yii::app()->service->getService($resource_type);
             $fieldObject = $fhirMarshal->parseXml($field);
             $tx = Yii::app()->db->beginTransaction();
             $ref = $service->fhirCreate($fieldObject);
             $tx->commit();
             $refId = $ref->getId();
             $measurement = OphInVisualfields_Field_Measurement::model()->findByPk($refId);
             $study_datetime = $measurement->study_datetime;
             // Check for existing legacy events
             if (!($episode = Episode::model()->find('legacy = 1 AND patient_id = :patient_id', array(':patient_id' => $pid)))) {
                 echo '- No legacy episode found, creating...';
                 $episode = new Episode();
                 $episode->legacy = 1;
                 $episode->patient_id = $pid;
                 $episode->save();
                 echo 'done' . PHP_EOL;
                 // As there are no previous legacy events, we can create a new event
                 $this->newEvent($episode, $eventType, $measurement);
                 $this->move($this->archiveDir, $file);
             } else {
                 // There is a legacy episode, so there may be unmatched legacy field events
                 $criteria = new CdbCriteria();
                 $criteria->condition = 'event_type_id = :event_type_id and t.deleted = 0 and ep.deleted = 0 and ep.legacy = 1 and ep.patient_id = :patient_id';
                 $criteria->join = 'join episode ep on ep.id = t.episode_id';
                 $criteria->order = 't.event_date desc';
                 $criteria->params = array(':patient_id' => $pid, ':event_type_id' => $eventType->id);
                 if ($this->interval) {
                     // we're looking for all events that are bound to a legacy episode,
                     // for the given patient, looking for the last created test -
                     // this accounts for multiple tests per eye - the implication
                     // being that the newest test overrides the last test for the same eye
                     // (e.g. when a mistake is made and the test is re-ran):
                     // Base time on interval defined by user, a narrow time slot that the test falls within
                     $startCreatedTime = new DateTime($study_datetime);
                     $endCreatedTime = new DateTime($study_datetime);
                     $startCreatedTime->sub(new DateInterval($this->interval));
                     $endCreatedTime->add(new DateInterval($this->interval));
                     $criteria->condition .= ' AND t.event_date >= STR_TO_DATE("' . $startCreatedTime->format('Y-m-d H:i:s') . '", "%Y-%m-%d %H:%i:%s") AND t.event_date <= STR_TO_DATE("' . $endCreatedTime->format('Y-m-d H:i:s') . '", "%Y-%m-%d %H:%i:%s")';
                 }
                 // Of events, there can only be one or none:
                 // FIXME: This can return multiple events, so how do we choose?
                 $events = Event::model()->findAll($criteria);
                 if (count($events) == 1) {
                     echo '- Found existing event (' . $events[0]->id . ')' . PHP_EOL;
                     $element = Element_OphInVisualfields_Image::model()->find('event_id = :event_id', array(':event_id' => $events[0]->id));
//.........这里部分代码省略.........
开发者ID:openeyes,项目名称:openeyes,代码行数:101,代码来源:ImportLegacyVFCommand.php


注:本文中的Patient::search方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。