This commit is contained in:
2024-08-06 15:33:14 +08:00
parent b286bf195f
commit 7bf9d51b8f
4 changed files with 139 additions and 88 deletions

View File

@@ -1,22 +1,28 @@
/nbproject/ /nbproject/
#/thinkphp/ #/thinkphp/
#/vendor/ #/vendor/
#/application/extra
/runtime/* /runtime/*
#/addons/* #/addons/*
#/public/assets/libs/ /application/admin/command/Install/*.lock
#/public/assets/addons/* #/public/assets/addons/*
/public/uploads/* /public/uploads/*
.idea .idea
composer.lock composer.lock
.env.sample
*.log *.log
*.css.map *.css.map
!.gitkeep !.gitkeep
.env .env
.svn .svn
.vscode .vscode
node_modules #application/extra/*
.user.ini .user.ini
#/application/database.php
js_api_ticket.txt
.well-known
webautocode
webautocodestatic
.git .git
.git* .git*
*.pid *.pid

View File

@@ -1,90 +1,121 @@
<?php <?php
namespace app\api\controller; namespace app\api\controller;
use think\Db; use think\Db;
use app\common\model\TabConf; use app\common\model\TabConf;
use wanghua\general_utility_tools_php\file\upload\FileUpload; use wanghua\general_utility_tools_php\file\upload\FileUpload;
use wanghua\general_utility_tools_php\tool\Tools; use wanghua\general_utility_tools_php\tool\Tools;
use wanghua\general_utility_tools_php\Validate; use wanghua\general_utility_tools_php\Validate;
use think\Controller; use think\Controller;
class Hdrquestionnairequestion extends BaseHttpApi class Hdrquestionnairequestion extends BaseHttpApi
{ {
protected $controller_comments = '科室问卷问题(一个问题对应多个答案)'; protected $controller_comments = '科室问卷问题(一个问题对应多个答案)';
/**
* desc获取科室问卷问题(一个问题对应多个答案)
* /**
* api/Hdrquestionnairequestion/getHdrquestionnairequestionList * desc获取科室问卷问题(一个问题对应多个答案)
* *
* api/Hdrquestionnairequestion/getHdrquestionnairequestionList
* *
* 带分页 * 参数:
* current_page 当前页码 * 带分页
* current_page 当前页码 * current_page 当前页码
* list_rows 每页显示条数 默认15 * list_rows 每页显示条数 默认15
* id ID * id ID
* hdrdepartment_id 所属科室 * hdrdepartment_id 所属科室
* * question 问卷问题
* 所有字段说明<span style="color: gray">(可能有部分额外字段未在此体现)</span> * is_common 是否通用:yes=是,no=否
* id ID * is_only_boy 只适合男:yes=是,no=否
* hdrdepartment_id 所属科室
* question 问卷问题
* fit_sex 适合对象:all=全部,gg=男,mm=女
* is_only_girl 只适合女:yes=是,no=否 * is_only_girl 只适合女:yes=是,no=否
* create_time 创建时间 * type 选项类型:one=单选,more=多选
* update_time 更新时间 * create_time 创建时间
*
* authorwh * 所有字段说明<span style="color: gray">(可能有部分额外字段未在此体现)</span>
*/ * id ID
function getHdrquestionnairequestionList(){ * hdrdepartment_id 所属科室
Tools::log_to_write_txt(['获取科室问卷问题(一个问题对应多个答案) 入参:'=>input()]); * question 问卷问题
$api_desc = '获取科室问卷问题(一个问题对应多个答案)'; * is_common 是否通用:yes=是,no=否
try { * is_only_boy 只适合男:yes=是,no=否
* is_only_girl 只适合女:yes=是,no=否
$id = input('id'); * type 选项类型:one=单选,more=多选
$hdrdepartment_id = input('hdrdepartment_id'); * create_time 创建时间
$question = input('question'); * update_time 更新时间
* authorwh
$model_obj = Db::table(TabConf::$fa_hdrquestionnairequestion); */
function getHdrquestionnairequestionList(){
if(input('id')){ Tools::log_to_write_txt(['获取科室问卷问题(一个问题对应多个答案) 入参:'=>input()]);
$model_obj->where('id',input('id')); $api_desc = '获取科室问卷问题(一个问题对应多个答案)';
} try {
if(input('hdrdepartment_id')){
$model_obj->where('hdrdepartment_id',input('hdrdepartment_id')); $id = input('id');
} $hdrdepartment_id = input('hdrdepartment_id');
if(input('question')){ if(empty($hdrdepartment_id)){
$model_obj->where('question',input('question')); return json(Tools::set_fail('参数错误'));
} }
$data = $model_obj->paginate(['page'=>input('current_page',1),'list_rows'=>input('list_rows',15)]) $question = input('question');
->each(function($item, $key){ $is_common = input('is_common');
$is_only_boy = input('is_only_boy');
$is_only_girl = input('is_only_girl');
$type = input('type');
return $item; $create_time = input('create_time');
});
// ['total'] => int(30) $model_obj = Db::table(TabConf::$fa_hdrquestionnairequestion);
// ['per_page'] => int(15)
// ['current_page'] => int(1) if(input('id')){
// ['last_page''] => int(2) $model_obj->where('id',input('id'));
$data = $data->toArray();//包含 data列表 }
if(input('hdrdepartment_id')){
$model_obj->where('hdrdepartment_id',input('hdrdepartment_id'));
}
if(input('question')){
return json(Tools::set_ok('ok',$data)); $model_obj->where('question',input('question'));
}catch(\Exception $e){ }
Tools::log_to_write_txt([ if(input('is_common')){
'error'=>'获取科室问卷问题(一个问题对应多个答案).异常.'.$e->getMessage(), $model_obj->where('is_common',input('is_common'));
'参数'=>input(), }
'error_info'=>$e->getTraceAsString() if(input('is_only_boy')){
]); $model_obj->where('is_only_boy',input('is_only_boy'));
return json(Tools::set_res(500,'操作异常',[])); }
} if(input('is_only_girl')){
} $model_obj->where('is_only_girl',input('is_only_girl'));
}
if(input('type')){
$model_obj->where('type',input('type'));
}
if(input('create_time')){
$model_obj->where('create_time',input('create_time'));
}
$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,'操作异常',[]));
}
} }

View File

@@ -86,12 +86,19 @@
* id ID * id ID
* hdrdepartment_id 所属科室 * hdrdepartment_id 所属科室
* question 问卷问题 * question 问卷问题
* is_common 是否通用:yes=是,no=否
* is_only_boy 只适合男:yes=是,no=否
* is_only_girl 只适合女:yes=是,no=否
* type 选项类型:one=单选,more=多选
* create_time 创建时间
* *
* 所有字段说明<span style="color: gray">(可能有部分额外字段未在此体现)</span> * 所有字段说明<span style="color: gray">(可能有部分额外字段未在此体现)</span>
* id ID * id ID
* hdrdepartment_id 所属科室 * hdrdepartment_id 所属科室
* question 问卷问题 * question 问卷问题
* fit_sex 适合对象:all=全部,gg=男,mm=女 * is_common 是否通用:yes=是,no=否
* is_only_boy 只适合男:yes=是,no=否
* is_only_girl 只适合女:yes=是,no=否
* type 选项类型:one=单选,more=多选 * type 选项类型:one=单选,more=多选
* create_time 创建时间 * create_time 创建时间
* update_time 更新时间 * update_time 更新时间

View File

@@ -64,12 +64,19 @@
* id ID * id ID
* hdrdepartment_id 所属科室 * hdrdepartment_id 所属科室
* question 问卷问题 * question 问卷问题
* is_common 是否通用:yes=是,no=否
* is_only_boy 只适合男:yes=是,no=否
* is_only_girl 只适合女:yes=是,no=否
* type 选项类型:one=单选,more=多选
* create_time 创建时间
* *
* 所有字段说明<span style="color: gray">(可能有部分额外字段未在此体现)</span> * 所有字段说明<span style="color: gray">(可能有部分额外字段未在此体现)</span>
* id ID * id ID
* hdrdepartment_id 所属科室 * hdrdepartment_id 所属科室
* question 问卷问题 * question 问卷问题
* fit_sex 适合对象:all=全部,gg=男,mm=女 * is_common 是否通用:yes=是,no=否
* is_only_boy 只适合男:yes=是,no=否
* is_only_girl 只适合女:yes=是,no=否
* type 选项类型:one=单选,more=多选 * type 选项类型:one=单选,more=多选
* create_time 创建时间 * create_time 创建时间
* update_time 更新时间 * update_time 更新时间