Files
fast_response/digital_doctor/application/api/controller/Hdrhealthinsight.php
2025-03-17 10:56:09 +08:00

85 lines
2.6 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace app\api\controller;
use think\Db;
use app\common\model\TabConf;
use wanghua\general_utility_tools_php\file\upload\FileUpload;
use wanghua\general_utility_tools_php\tool\Tools;
use wanghua\general_utility_tools_php\Validate;
use think\Controller;
class Hdrhealthinsight extends BaseHttpApi
{
protected $controller_comments = '患者健康洞察';
/**
* desc获取患者健康洞察
*
* api/Hdrhealthinsight/getHdrhealthinsightList
*
* 参数:
* 带分页
* current_page 当前页码
* list_rows 每页显示条数 默认15
* id ID
* hdruserbaseinfo_id 统一基本信息 【必须】
*
* 所有字段说明<span style="color: gray">(可能有部分额外字段未在此体现)</span>
* id ID
* hdruserbaseinfo_id 统一基本信息
* content 洞察内容
* authorwh
*/
function getHdrhealthinsightList(){
Tools::log_to_write_txt(['获取患者健康洞察 入参:'=>input()]);
$api_desc = '获取患者健康洞察';
try {
$id = input('id');
$hdruserbaseinfo_id = input('hdruserbaseinfo_id');
if(empty($hdruserbaseinfo_id)){
return json(Tools::set_fail('参数错误.1',['error_msg'=>'错误信息hdruserbaseinfo_id错误']));
}
$model_obj = Db::table(TabConf::$fa_hdrhealth_insight);
if(input('id')){
$model_obj->where('id',input('id'));
}
if(input('hdruserbaseinfo_id')){
$model_obj->where('hdruserbaseinfo_id',input('hdruserbaseinfo_id'));
}
$data = $model_obj->paginate(['page'=>input('current_page',1),'list_rows'=>input('list_rows',15)])
->each(function($item, $key){
return $item;
});
// ['total'] => int(30)
// ['per_page'] => int(15)
// ['current_page'] => int(1)
// ['last_page''] => int(2)
$data = $data->toArray();//包含 data列表
return json(Tools::set_ok('ok',$data));
}catch(\Exception $e){
Tools::log_to_write_txt([
'error'=>'获取患者健康洞察.异常.'.$e->getMessage(),
'参数'=>input(),
'error_info'=>$e->getTraceAsString()
]);
return json(Tools::set_res(500,'操作异常',[]));
}
}
}