本文整理汇总了PHP中Test::select方法的典型用法代码示例。如果您正苦于以下问题:PHP Test::select方法的具体用法?PHP Test::select怎么用?PHP Test::select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Test
的用法示例。
在下文中一共展示了Test::select方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
/**
* Display the specified patient.
*
* @param int $id
* @return Response
*/
public function show($id)
{
$patient = Patient::findOrFail($id);
$tests = Test::select('tests.id', 'test', 'result', 'diagnosis', 'tests.created_at', 'item')->where('patient_id', '=', $id)->join('billings', 'billings.id', '=', 'tests.test')->get();
$medications = Medication::select('medications.id', 'prescription', 'dosage', 'start_date', 'end_date', 'item')->where('patient_id', '=', $id)->join('billings', 'billings.id', '=', 'medications.prescription')->get();
$visit = Visit::where('patient_id', '=', $id)->first();
return View::make('patients.show', compact('patient', 'tests', 'medications', 'visit'));
}
示例2: getMonths
/**
* Get months: return months for time_created column when filter dates are set
*/
public static function getMonths($from, $to)
{
$today = "'" . date("Y-m-d") . "'";
$year = date('Y');
$tests = Test::select('time_created')->distinct();
if (strtotime($from) === strtotime($today)) {
$tests = $tests->where('time_created', 'LIKE', $year . '%');
} else {
$toPlusOne = date_add(new DateTime($to), date_interval_create_from_date_string('1 day'));
$tests = $tests->whereBetween('time_created', array($from, $toPlusOne));
}
$allDates = $tests->lists('time_created');
asort($allDates);
$yearMonth = function ($value) {
return strtotime(substr($value, 0, 7));
};
$allDates = array_map($yearMonth, $allDates);
$allMonths = array_unique($allDates);
$dates = array();
foreach ($allMonths as $date) {
$dateInfo = getdate($date);
$dates[] = array('months' => $dateInfo['mon'], 'label' => substr($dateInfo['month'], 0, 3), 'annum' => $dateInfo['year']);
}
return json_encode($dates);
}
示例3: getPrevalenceCounts
/**
* Return the prevalence counts for all TestTypes for the given date range
*
* @param $from, $to
*/
public static function getPrevalenceCounts($from, $to, $testTypeID = 0)
{
$toPlusOne = date_add(new DateTime($to), date_interval_create_from_date_string('1 day'));
// TODO: Should be changed to a more flexible format i.e. that supports localization
$data = Test::select(DB::raw("test_types.id as id, test_types.name as test, " . "COUNT(DISTINCT tests.specimen_id) as total, " . "COUNT(DISTINCT IF((test_results.result='Positive' OR " . "(measure_ranges.alphanumeric = test_results.result AND measure_ranges.interpretation = 'Positive'))," . "tests.specimen_id,NULL)) positive, " . "COUNT(DISTINCT IF((test_results.result='Negative' OR " . "(measure_ranges.alphanumeric = test_results.result AND measure_ranges.interpretation = 'Negative'))," . "tests.specimen_id,NULL)) negative, " . "ROUND(COUNT(DISTINCT IF((test_results.result = 'Positive' OR " . "(measure_ranges.alphanumeric = test_results.result AND measure_ranges.interpretation = 'Positive'))" . ", tests.specimen_id, NULL))*100/COUNT(DISTINCT tests.specimen_id ) , 2 ) AS rate"))->join('test_types', 'tests.test_type_id', '=', 'test_types.id')->join('testtype_measures', 'test_types.id', '=', 'testtype_measures.test_type_id')->join('measure_ranges', 'testtype_measures.measure_id', '=', 'measure_ranges.measure_id')->join('measures', 'testtype_measures.measure_id', '=', 'measures.id')->join('test_results', function ($join) {
$join->on('tests.id', '=', 'test_results.test_id')->on('testtype_measures.measure_id', '=', 'test_results.measure_id');
})->join('measure_types', 'measure_types.id', '=', 'measures.measure_type_id')->whereIn('test_status_id', array(Test::COMPLETED, Test::VERIFIED))->where(function ($query) use($testTypeID) {
if ($testTypeID != 0) {
$query->where('tests.test_type_id', $testTypeID);
}
})->where(function ($query) {
$query->where('measure_ranges.alphanumeric', '=', 'Positive')->orWhere('measure_ranges.alphanumeric', '=', 'Negative')->orWhere('measure_ranges.interpretation', '=', 'Positive')->orWhere('measure_ranges.interpretation', '=', 'Negative');
})->whereBetween('time_created', array($from, $toPlusOne))->groupBy('test_types.id')->get();
return $data;
}
示例4: array
}
}
if ($tag == 'updateTest') {
$value['col2'] = '100000';
$value['col1'] = '100000';
$response_data = $test->Update($value, 17);
if (sizeof($response_data) == 0) {
$response[] = array('success' => 0, 'message' => 'No Data Found');
} else {
$response[] = array('success' => 1, 'data' => $response_data);
}
}
if ($tag == 'selectTest') {
$column = "col1,col3";
$where = "";
$response_data = $test->select($column, $where);
if (sizeof($response_data) == 0) {
$response[] = array('success' => 0, 'message' => 'No Data Found');
} else {
$response[] = array('success' => 1, 'data' => $response_data);
}
}
if ($tag == 'selectJoinTest') {
$table = "*";
$where = "col1=1";
$response_data = $test->select_join($table, $where);
if (sizeof($response_data) == 0) {
$response[] = array('success' => 0, 'message' => 'No Data Found');
} else {
$response[] = array('success' => 1, 'data' => $response_data);
}
示例5: getTestBills
/**
* Test bills helper function
*
*@return array
*/
public function getTestBills($id)
{
return Test::select('item', 'type', 'price', 'test', 'tests.created_at')->where('visit_id', '=', $this->getVisit($id)->id)->join('billings', 'billings.id', '=', 'test')->where('tests.patient_id', '=', $id)->get();
}
示例6: getTestsPerformed
/**
* Get the tests performed by a user
*
* @return db resultset
*/
public static function getTestsPerformed($from, $to, $userID = 0)
{
$tests = Test::select(['id'])->whereBetween('time_completed', [$from, $to]);
if ($userID > 0) {
$tests = $tests->where('tested_by', '=', $userID);
}
return $tests->get();
}