fixed
This commit is contained in:
@@ -1,182 +1,220 @@
|
|||||||
<?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 Hdrquestionnaireanswer extends BaseHttpApi
|
class Hdrquestionnaireanswer extends BaseHttpApi
|
||||||
{
|
{
|
||||||
protected $controller_comments = '科室问卷答案';
|
protected $controller_comments = '科室问卷答案';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* desc:获取科室问卷答案
|
* desc:获取科室问卷答案
|
||||||
*
|
*
|
||||||
* api/Hdrquestionnaireanswer/getHdrquestionnaireanswerList
|
* api/Hdrquestionnaireanswer/getHdrquestionnaireanswerList
|
||||||
*
|
*
|
||||||
* 参数:
|
* 参数:
|
||||||
* 带分页
|
* 带分页
|
||||||
* current_page 当前页码
|
* current_page 当前页码
|
||||||
* list_rows 每页显示条数 默认15
|
* list_rows 每页显示条数 默认15
|
||||||
* id ID
|
* id ID
|
||||||
* hdrquestionnairequestion_id 问卷问题ID
|
* hdrquestionnairequestion_id 问卷问题ID
|
||||||
* answer 问卷答案
|
* answer 问卷答案
|
||||||
*
|
*
|
||||||
* 所有字段说明<span style="color: gray">(可能有部分额外字段未在此体现)</span>:
|
* 所有字段说明<span style="color: gray">(可能有部分额外字段未在此体现)</span>:
|
||||||
* id ID
|
* id ID
|
||||||
* hdrquestionnairequestion_id 问卷问题ID
|
* hdrquestionnairequestion_id 问卷问题ID
|
||||||
* answer 问卷答案
|
* answer 问卷答案
|
||||||
* create_time 创建时间
|
* create_time 创建时间
|
||||||
* update_time 更新时间
|
* update_time 更新时间
|
||||||
|
|
||||||
* author:wh
|
* author:wh
|
||||||
*/
|
*/
|
||||||
function getHdrquestionnaireanswerList(){
|
function getHdrquestionnaireanswerList(){
|
||||||
Tools::log_to_write_txt(['获取科室问卷答案 入参:'=>input()]);
|
Tools::log_to_write_txt(['获取科室问卷答案 入参:'=>input()]);
|
||||||
$api_desc = '获取科室问卷答案';
|
$api_desc = '获取科室问卷答案';
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$id = input('id');
|
$id = input('id');
|
||||||
$hdrquestionnairequestion_id = input('hdrquestionnairequestion_id');
|
$hdrquestionnairequestion_id = input('hdrquestionnairequestion_id');
|
||||||
$answer = input('answer');
|
$answer = input('answer');
|
||||||
|
|
||||||
|
|
||||||
$model_obj = Db::table(TabConf::$fa_hdrquestionnaireanswer);
|
$model_obj = Db::table(TabConf::$fa_hdrquestionnaireanswer);
|
||||||
|
|
||||||
if(input('id')){
|
if(input('id')){
|
||||||
$model_obj->where('id',input('id'));
|
$model_obj->where('id',input('id'));
|
||||||
}
|
}
|
||||||
if(input('hdrquestionnairequestion_id')){
|
if(input('hdrquestionnairequestion_id')){
|
||||||
$model_obj->where('hdrquestionnairequestion_id',input('hdrquestionnairequestion_id'));
|
$model_obj->where('hdrquestionnairequestion_id',input('hdrquestionnairequestion_id'));
|
||||||
}
|
}
|
||||||
if(input('answer')){
|
if(input('answer')){
|
||||||
$model_obj->where('answer',input('answer'));
|
$model_obj->where('answer',input('answer'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = $model_obj->paginate(['page'=>input('current_page',1),'list_rows'=>input('list_rows',15)])
|
$data = $model_obj->paginate(['page'=>input('current_page',1),'list_rows'=>input('list_rows',15)])
|
||||||
->each(function($item, $key){
|
->each(function($item, $key){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return $item;
|
return $item;
|
||||||
});
|
});
|
||||||
|
|
||||||
// ['total'] => int(30)
|
// ['total'] => int(30)
|
||||||
// ['per_page'] => int(15)
|
// ['per_page'] => int(15)
|
||||||
// ['current_page'] => int(1)
|
// ['current_page'] => int(1)
|
||||||
// ['last_page''] => int(2)
|
// ['last_page''] => int(2)
|
||||||
$data = $data->toArray();//包含 data列表
|
$data = $data->toArray();//包含 data列表
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return json(Tools::set_ok('ok',$data));
|
return json(Tools::set_ok('ok',$data));
|
||||||
}catch(\Exception $e){
|
}catch(\Exception $e){
|
||||||
Tools::log_to_write_txt([
|
Tools::log_to_write_txt([
|
||||||
'error'=>'获取科室问卷答案.异常.'.$e->getMessage(),
|
'error'=>'获取科室问卷答案.异常.'.$e->getMessage(),
|
||||||
'参数'=>input(),
|
'参数'=>input(),
|
||||||
'error_info'=>$e->getTraceAsString()
|
'error_info'=>$e->getTraceAsString()
|
||||||
]);
|
]);
|
||||||
return json(Tools::set_res(500,'操作异常',[]));
|
return json(Tools::set_res(500,'操作异常',[]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增一个问卷答案
|
* 新增一个问卷答案
|
||||||
|
*
|
||||||
* 参数:
|
* 参数:
|
||||||
* hdrquestionnairequestion_id 问卷问题ID 问卷问题ID 必须
|
* hdrquestionnairequestion_id 问卷问题ID 问卷问题ID 必须
|
||||||
* hdrquestionnairequestion_id 问卷问题ID 问卷问题ID 必须
|
* answer 问卷答案 问卷答案 必须
|
||||||
* answer 问卷答案 问卷答案 必须
|
* api/Hdrquestionnaireanswer/addHdrquestionnaireanswer
|
||||||
* api/Hdrquestionnaireanswer/addHdrquestionnaireanswer
|
*/
|
||||||
*/
|
function addHdrquestionnaireanswer(){
|
||||||
function addHdrquestionnaireanswer(){
|
Tools::log_to_write_txt(['新增一个问卷答案'=>input()]);
|
||||||
Tools::log_to_write_txt(['新增一个问卷答案'=>input()]);
|
$api_desc = '新增一个问卷答案';
|
||||||
$api_desc = '新增一个问卷答案';
|
Db::startTrans();
|
||||||
Db::startTrans();
|
try {
|
||||||
try {
|
|
||||||
|
$hdrquestionnairequestion_id = input('hdrquestionnairequestion_id');
|
||||||
$hdrquestionnairequestion_id = input('hdrquestionnairequestion_id');
|
if(empty($hdrquestionnairequestion_id)){
|
||||||
if(empty($hdrquestionnairequestion_id)){
|
return json(Tools::set_fail('参数错误.0'));
|
||||||
return json(Tools::set_fail('参数错误.0'));
|
}
|
||||||
}
|
|
||||||
|
$answer = input('answer');
|
||||||
$answer = input('answer');
|
if(empty($answer)){
|
||||||
if(empty($answer)){
|
return json(Tools::set_fail('参数错误.1'));
|
||||||
return json(Tools::set_fail('参数错误.1'));
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
$data = [
|
||||||
$data = [
|
'hdrquestionnairequestion_id'=>$hdrquestionnairequestion_id?:'',
|
||||||
'hdrquestionnairequestion_id'=>$hdrquestionnairequestion_id?:'',
|
'answer'=>$answer?:'',
|
||||||
'answer'=>$answer?:'',
|
];
|
||||||
];
|
|
||||||
|
|
||||||
|
$dataid = Db::table(TabConf::$fa_hdrquestionnaireanswer)->insertGetId($data);
|
||||||
$dataid = Db::table(TabConf::$fa_hdrquestionnaireanswer)->insertGetId($data);
|
|
||||||
|
$this->operateLog('新增一个问卷答案',api_user_info('id'));
|
||||||
$this->operateLog('新增一个问卷答案',api_user_info('id'));
|
Db::commit();
|
||||||
Db::commit();
|
return json(Tools::set_ok('ok',$dataid));
|
||||||
return json(Tools::set_ok('ok',$dataid));
|
}catch (\Exception $e){
|
||||||
}catch (\Exception $e){
|
Db::rollback();
|
||||||
Db::rollback();
|
Tools::log_to_write_txt([
|
||||||
Tools::log_to_write_txt([
|
'error'=>'新增一个问卷答案.异常.'.$e->getMessage(),
|
||||||
'error'=>'新增一个问卷答案.异常.'.$e->getMessage(),
|
'input'=>input(),
|
||||||
'input'=>input(),
|
'error_info'=>$e->getTraceAsString()
|
||||||
'error_info'=>$e->getTraceAsString()
|
]);
|
||||||
]);
|
return json(Tools::set_fail());
|
||||||
return json(Tools::set_fail());
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改科室问卷答案
|
||||||
* 参数:
|
* 参数:
|
||||||
* id ID ID 必须
|
* id ID ID 必须
|
||||||
* hdrquestionnairequestion_id 问卷问题ID
|
* hdrquestionnairequestion_id 问卷问题ID
|
||||||
* id ID ID 必须
|
* answer 问卷答案
|
||||||
* hdrquestionnairequestion_id 问卷问题ID
|
* api/Hdrquestionnaireanswer/updateHdrquestionnaireanswer
|
||||||
* answer 问卷答案
|
*/
|
||||||
* api/Hdrquestionnaireanswer/updateHdrquestionnaireanswer
|
function updateHdrquestionnaireanswer(){
|
||||||
*/
|
Tools::log_to_write_txt(['修改科室问卷答案'=>input()]);
|
||||||
function updateHdrquestionnaireanswer(){
|
|
||||||
Tools::log_to_write_txt(['修改科室问卷答案'=>input()]);
|
$api_desc = '修改科室问卷答案';
|
||||||
|
Db::startTrans();
|
||||||
$api_desc = '修改科室问卷答案';
|
try {
|
||||||
Db::startTrans();
|
|
||||||
try {
|
$hdrquestionnairequestion_id = input('hdrquestionnairequestion_id');
|
||||||
|
$answer = input('answer');
|
||||||
$hdrquestionnairequestion_id = input('hdrquestionnairequestion_id');
|
if(empty(input('id'))){
|
||||||
$answer = input('answer');
|
return json(Tools::set_fail('参数错误。0'));
|
||||||
if(empty(input('id'))){
|
}
|
||||||
return json(Tools::set_fail('参数错误。0'));
|
|
||||||
}
|
|
||||||
|
$data = [
|
||||||
|
'hdrquestionnairequestion_id'=>$hdrquestionnairequestion_id?:'',
|
||||||
$data = [
|
'answer'=>$answer?:'',
|
||||||
'hdrquestionnairequestion_id'=>$hdrquestionnairequestion_id?:'',
|
];
|
||||||
'answer'=>$answer?:'',
|
|
||||||
];
|
|
||||||
|
$dataid = Db::table(TabConf::$fa_hdrquestionnaireanswer)
|
||||||
|
->data($data)
|
||||||
$dataid = Db::table(TabConf::$fa_hdrquestionnaireanswer)
|
->where('id',input('id'))
|
||||||
->data($data)
|
->update();
|
||||||
->where('id',input('id'))
|
|
||||||
->update();
|
$this->operateLog('修改科室问卷答案',api_user_info('id'));
|
||||||
|
Db::commit();
|
||||||
$this->operateLog('修改科室问卷答案',api_user_info('id'));
|
return json(Tools::set_ok('ok',$dataid));
|
||||||
Db::commit();
|
}catch (\Exception $e){
|
||||||
return json(Tools::set_ok('ok',$dataid));
|
Db::rollback();
|
||||||
}catch (\Exception $e){
|
Tools::log_to_write_txt([
|
||||||
Db::rollback();
|
'error'=>'修改科室问卷答案.异常.'.$e->getMessage(),
|
||||||
Tools::log_to_write_txt([
|
'input'=>input(),
|
||||||
'error'=>'修改科室问卷答案.异常.'.$e->getMessage(),
|
'error_info'=>$e->getTraceAsString()
|
||||||
'input'=>input(),
|
]);
|
||||||
'error_info'=>$e->getTraceAsString()
|
return json(Tools::set_fail());
|
||||||
]);
|
}
|
||||||
return json(Tools::set_fail());
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* desc: 删除科室问卷答案
|
||||||
|
* author:wh
|
||||||
|
*
|
||||||
|
* 参数:
|
||||||
|
* id 数据id 必须
|
||||||
|
* api/Hdrquestionnaireanswer/del
|
||||||
|
*/
|
||||||
|
function del(){
|
||||||
|
Tools::log_to_write_txt(['删除科室问卷答案'=>input()]);
|
||||||
|
|
||||||
|
$api_desc = '删除科室问卷答案';
|
||||||
|
try {
|
||||||
|
|
||||||
|
$id = input('id');
|
||||||
|
if(empty($id)){
|
||||||
|
return json(Tools::set_fail('参数错误。0'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Db::table(TabConf::$fa_hdrquestionnairequestion)
|
||||||
|
->where('id',$id)
|
||||||
|
->delete();
|
||||||
|
|
||||||
|
|
||||||
|
return json(Tools::set_ok('ok'));
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Tools::log_to_write_txt([
|
||||||
|
'error'=>'删除科室问卷答案.异常.'.$e->getMessage(),
|
||||||
|
'input'=>input(),
|
||||||
|
'error_info'=>$e->getTraceAsString()
|
||||||
|
]);
|
||||||
|
return json(Tools::set_fail());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,27 +1,28 @@
|
|||||||
<?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:获取科室问卷问题(一个问题对应多个答案)
|
* desc:获取科室问卷问题(一个问题对应多个答案)
|
||||||
*
|
*
|
||||||
* api/Hdrquestionnairequestion/getHdrquestionnairequestionList
|
* api/Hdrquestionnairequestion/getHdrquestionnairequestionList
|
||||||
|
*
|
||||||
* 参数:
|
* 参数:
|
||||||
* 参数:
|
* 带分页
|
||||||
* 带分页
|
* current_page 当前页码
|
||||||
* list_rows 每页显示条数 默认15
|
* list_rows 每页显示条数 默认15
|
||||||
* question 问卷问题
|
* question 问卷问题
|
||||||
* id ID
|
* id ID
|
||||||
@@ -30,168 +31,170 @@ class Hdrquestionnairequestion extends BaseHttpApi
|
|||||||
* is_common 是否通用:yes=是,no=否
|
* is_common 是否通用:yes=是,no=否
|
||||||
* is_only_boy 只适合男:yes=是,no=否
|
* is_only_boy 只适合男:yes=是,no=否
|
||||||
* is_only_girl 只适合女:yes=是,no=否
|
* is_only_girl 只适合女:yes=是,no=否
|
||||||
* is_only_girl 只适合女:yes=是,no=否
|
* type 选项类型:one=单选,more=多选
|
||||||
* type 选项类型:one=单选,more=多选
|
*
|
||||||
* 所有字段说明<span style="color: gray">(可能有部分额外字段未在此体现)</span>:
|
* 所有字段说明<span style="color: gray">(可能有部分额外字段未在此体现)</span>:
|
||||||
* 所有字段说明<span style="color: gray">(可能有部分额外字段未在此体现)</span>:
|
* id ID
|
||||||
* id ID
|
* hdrdepartment_id 所属科室
|
||||||
* hdrdepartment_id 所属科室
|
* question 问卷问题
|
||||||
* question 问卷问题
|
* is_common 是否通用:yes=是,no=否
|
||||||
* is_common 是否通用:yes=是,no=否
|
* is_only_boy 只适合男:yes=是,no=否
|
||||||
* is_only_boy 只适合男:yes=是,no=否
|
* is_only_girl 只适合女:yes=是,no=否
|
||||||
* is_only_girl 只适合女:yes=是,no=否
|
* type 选项类型:one=单选,more=多选
|
||||||
* type 选项类型:one=单选,more=多选
|
* create_time 创建时间
|
||||||
* create_time 创建时间
|
* update_time 更新时间
|
||||||
* update_time 更新时间
|
|
||||||
|
* author:wh
|
||||||
* author:wh
|
*/
|
||||||
*/
|
function getHdrquestionnairequestionList(){
|
||||||
function getHdrquestionnairequestionList(){
|
Tools::log_to_write_txt(['获取科室问卷问题(一个问题对应多个答案) 入参:'=>input()]);
|
||||||
Tools::log_to_write_txt(['获取科室问卷问题(一个问题对应多个答案) 入参:'=>input()]);
|
$api_desc = '获取科室问卷问题(一个问题对应多个答案)';
|
||||||
$api_desc = '获取科室问卷问题(一个问题对应多个答案)';
|
try {
|
||||||
try {
|
|
||||||
|
$id = input('id');
|
||||||
$id = input('id');
|
$hdrdepartment_id = input('hdrdepartment_id');
|
||||||
$hdrdepartment_id = input('hdrdepartment_id');
|
if(empty($hdrdepartment_id)){
|
||||||
if(empty($hdrdepartment_id)){
|
return json(Tools::set_fail('hdrdepartment_id参数错误'));
|
||||||
return json(Tools::set_fail('hdrdepartment_id参数错误'));
|
}
|
||||||
}
|
|
||||||
|
$question = input('question');
|
||||||
$question = input('question');
|
$is_common = input('is_common');
|
||||||
$is_common = input('is_common');
|
$is_only_boy = input('is_only_boy');
|
||||||
$is_only_boy = input('is_only_boy');
|
$is_only_girl = input('is_only_girl');
|
||||||
$is_only_girl = input('is_only_girl');
|
$type = input('type');
|
||||||
$type = input('type');
|
|
||||||
|
|
||||||
|
$model_obj = Db::table(TabConf::$fa_hdrquestionnairequestion);
|
||||||
$model_obj = Db::table(TabConf::$fa_hdrquestionnairequestion);
|
|
||||||
|
if(input('question')){
|
||||||
if(input('question')){
|
$model_obj->whereLike('question','%'.input('question').'%');
|
||||||
$model_obj->whereLike('question','%'.input('question').'%');
|
}
|
||||||
}
|
|
||||||
|
if(input('id')){
|
||||||
if(input('id')){
|
$model_obj->where('id',input('id'));
|
||||||
$model_obj->where('id',input('id'));
|
}
|
||||||
}
|
if(input('hdrdepartment_id')){
|
||||||
if(input('hdrdepartment_id')){
|
$model_obj->where('hdrdepartment_id',input('hdrdepartment_id'));
|
||||||
$model_obj->where('hdrdepartment_id',input('hdrdepartment_id'));
|
}
|
||||||
}
|
if(input('is_common')){
|
||||||
if(input('is_common')){
|
$model_obj->where('is_common',input('is_common'));
|
||||||
$model_obj->where('is_common',input('is_common'));
|
}
|
||||||
}
|
if(input('is_only_boy')){
|
||||||
if(input('is_only_boy')){
|
$model_obj->where('is_only_boy',input('is_only_boy'));
|
||||||
$model_obj->where('is_only_boy',input('is_only_boy'));
|
}
|
||||||
}
|
if(input('is_only_girl')){
|
||||||
if(input('is_only_girl')){
|
$model_obj->where('is_only_girl',input('is_only_girl'));
|
||||||
$model_obj->where('is_only_girl',input('is_only_girl'));
|
}
|
||||||
}
|
if(input('type')){
|
||||||
if(input('type')){
|
$model_obj->where('type',input('type'));
|
||||||
$model_obj->where('type',input('type'));
|
}
|
||||||
}
|
|
||||||
|
$data = $model_obj->paginate(['page'=>input('current_page',1),'list_rows'=>input('list_rows',15)])
|
||||||
$data = $model_obj->paginate(['page'=>input('current_page',1),'list_rows'=>input('list_rows',15)])
|
->each(function($item, $key){
|
||||||
->each(function($item, $key){
|
|
||||||
|
|
||||||
|
|
||||||
|
return $item;
|
||||||
return $item;
|
});
|
||||||
});
|
|
||||||
|
// ['total'] => int(30)
|
||||||
// ['total'] => int(30)
|
// ['per_page'] => int(15)
|
||||||
// ['per_page'] => int(15)
|
// ['current_page'] => int(1)
|
||||||
// ['current_page'] => int(1)
|
// ['last_page''] => int(2)
|
||||||
// ['last_page''] => int(2)
|
$data = $data->toArray();//包含 data列表
|
||||||
$data = $data->toArray();//包含 data列表
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return json(Tools::set_ok('ok',$data));
|
||||||
return json(Tools::set_ok('ok',$data));
|
}catch(\Exception $e){
|
||||||
}catch(\Exception $e){
|
Tools::log_to_write_txt([
|
||||||
Tools::log_to_write_txt([
|
'error'=>'获取科室问卷问题(一个问题对应多个答案).异常.'.$e->getMessage(),
|
||||||
'error'=>'获取科室问卷问题(一个问题对应多个答案).异常.'.$e->getMessage(),
|
'参数'=>input(),
|
||||||
'参数'=>input(),
|
'error_info'=>$e->getTraceAsString()
|
||||||
'error_info'=>$e->getTraceAsString()
|
]);
|
||||||
]);
|
return json(Tools::set_res(500,'操作异常',[]));
|
||||||
return json(Tools::set_res(500,'操作异常',[]));
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
/**
|
* 新增科室问卷问题(一个问题对应多个答案)
|
||||||
|
*
|
||||||
* 参数:
|
* 参数:
|
||||||
* hdrdepartment_id 所属科室 所属科室 必须
|
* hdrdepartment_id 所属科室 所属科室 必须
|
||||||
* question 问卷问题 问卷问题 必须
|
* question 问卷问题 问卷问题 必须
|
||||||
* is_common 是否通用:yes=是,no=否 是否通用:yes=是,no=否 必须
|
* is_common 是否通用:yes=是,no=否 是否通用:yes=是,no=否 必须
|
||||||
* is_only_boy 只适合男:yes=是,no=否 只适合男:yes=是,no=否 必须
|
* is_only_boy 只适合男:yes=是,no=否 只适合男:yes=是,no=否 必须
|
||||||
* is_only_girl 只适合女:yes=是,no=否 只适合女:yes=是,no=否 必须
|
* is_only_girl 只适合女:yes=是,no=否 只适合女:yes=是,no=否 必须
|
||||||
* is_only_boy 只适合男:yes=是,no=否 只适合男:yes=是,no=否 必须
|
* type 选项类型:one=单选,more=多选 选项类型:one=单选,more=多选 必须
|
||||||
* is_only_girl 只适合女:yes=是,no=否 只适合女:yes=是,no=否 必须
|
* api/Hdrquestionnairequestion/addHdrquestionnairequestion
|
||||||
* type 选项类型:one=单选,more=多选 选项类型:one=单选,more=多选 必须
|
*/
|
||||||
* api/Hdrquestionnairequestion/addHdrquestionnairequestion
|
function addHdrquestionnairequestion(){
|
||||||
*/
|
Tools::log_to_write_txt(['新增科室问卷问题(一个问题对应多个答案)'=>input()]);
|
||||||
function addHdrquestionnairequestion(){
|
$api_desc = '新增科室问卷问题(一个问题对应多个答案)';
|
||||||
Tools::log_to_write_txt(['新增科室问卷问题(一个问题对应多个答案)'=>input()]);
|
Db::startTrans();
|
||||||
$api_desc = '新增科室问卷问题(一个问题对应多个答案)';
|
try {
|
||||||
Db::startTrans();
|
|
||||||
try {
|
$hdrdepartment_id = input('hdrdepartment_id');
|
||||||
|
if(empty($hdrdepartment_id)){
|
||||||
$hdrdepartment_id = input('hdrdepartment_id');
|
return json(Tools::set_fail('参数错误.0'));
|
||||||
if(empty($hdrdepartment_id)){
|
}
|
||||||
return json(Tools::set_fail('参数错误.0'));
|
|
||||||
}
|
$question = input('question');
|
||||||
|
if(empty($question)){
|
||||||
$question = input('question');
|
return json(Tools::set_fail('参数错误.1'));
|
||||||
if(empty($question)){
|
}
|
||||||
return json(Tools::set_fail('参数错误.1'));
|
|
||||||
}
|
$is_common = input('is_common');
|
||||||
|
if(empty($is_common)){
|
||||||
$is_common = input('is_common');
|
return json(Tools::set_fail('参数错误.2'));
|
||||||
if(empty($is_common)){
|
}
|
||||||
return json(Tools::set_fail('参数错误.2'));
|
|
||||||
}
|
$is_only_boy = input('is_only_boy');
|
||||||
|
if(empty($is_only_boy)){
|
||||||
$is_only_boy = input('is_only_boy');
|
return json(Tools::set_fail('参数错误.3'));
|
||||||
if(empty($is_only_boy)){
|
}
|
||||||
return json(Tools::set_fail('参数错误.3'));
|
|
||||||
}
|
$is_only_girl = input('is_only_girl');
|
||||||
|
if(empty($is_only_girl)){
|
||||||
$is_only_girl = input('is_only_girl');
|
return json(Tools::set_fail('参数错误.4'));
|
||||||
if(empty($is_only_girl)){
|
}
|
||||||
return json(Tools::set_fail('参数错误.4'));
|
|
||||||
}
|
$type = input('type');
|
||||||
|
if(empty($type)){
|
||||||
$type = input('type');
|
return json(Tools::set_fail('参数错误.5'));
|
||||||
if(empty($type)){
|
}
|
||||||
return json(Tools::set_fail('参数错误.5'));
|
|
||||||
}
|
|
||||||
|
$data = [
|
||||||
|
'hdrdepartment_id'=>$hdrdepartment_id?:'',
|
||||||
$data = [
|
'question'=>$question?:'',
|
||||||
'hdrdepartment_id'=>$hdrdepartment_id?:'',
|
'is_common'=>$is_common?:'',
|
||||||
'question'=>$question?:'',
|
'is_only_boy'=>$is_only_boy?:'',
|
||||||
'is_common'=>$is_common?:'',
|
'is_only_girl'=>$is_only_girl?:'',
|
||||||
'is_only_boy'=>$is_only_boy?:'',
|
'type'=>$type?:'',
|
||||||
'is_only_girl'=>$is_only_girl?:'',
|
];
|
||||||
'type'=>$type?:'',
|
|
||||||
];
|
|
||||||
|
$dataid = Db::table(TabConf::$fa_hdrquestionnairequestion)->insertGetId($data);
|
||||||
|
|
||||||
$dataid = Db::table(TabConf::$fa_hdrquestionnairequestion)->insertGetId($data);
|
$this->operateLog('新增科室问卷问题(一个问题对应多个答案)',api_user_info('id'));
|
||||||
|
Db::commit();
|
||||||
$this->operateLog('新增科室问卷问题(一个问题对应多个答案)',api_user_info('id'));
|
return json(Tools::set_ok('ok',$dataid));
|
||||||
Db::commit();
|
}catch (\Exception $e){
|
||||||
return json(Tools::set_ok('ok',$dataid));
|
Db::rollback();
|
||||||
}catch (\Exception $e){
|
Tools::log_to_write_txt([
|
||||||
Db::rollback();
|
'error'=>'新增科室问卷问题(一个问题对应多个答案).异常.'.$e->getMessage(),
|
||||||
Tools::log_to_write_txt([
|
'input'=>input(),
|
||||||
'error'=>'新增科室问卷问题(一个问题对应多个答案).异常.'.$e->getMessage(),
|
'error_info'=>$e->getTraceAsString()
|
||||||
'input'=>input(),
|
]);
|
||||||
'error_info'=>$e->getTraceAsString()
|
return json(Tools::set_fail());
|
||||||
]);
|
}
|
||||||
return json(Tools::set_fail());
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
/**
|
||||||
|
* 修改科室问卷问题(一个问题对应多个答案)
|
||||||
* 参数:
|
* 参数:
|
||||||
* id ID ID 必须
|
* id ID ID 必须
|
||||||
* hdrdepartment_id 所属科室
|
* hdrdepartment_id 所属科室
|
||||||
@@ -199,54 +202,90 @@ class Hdrquestionnairequestion extends BaseHttpApi
|
|||||||
* is_common 是否通用:yes=是,no=否
|
* is_common 是否通用:yes=是,no=否
|
||||||
* is_only_boy 只适合男:yes=是,no=否
|
* is_only_boy 只适合男:yes=是,no=否
|
||||||
* is_only_girl 只适合女:yes=是,no=否
|
* is_only_girl 只适合女:yes=是,no=否
|
||||||
* is_common 是否通用:yes=是,no=否
|
* type 选项类型:one=单选,more=多选
|
||||||
* is_only_boy 只适合男:yes=是,no=否
|
* api/Hdrquestionnairequestion/updateHdrquestionnairequestion
|
||||||
* is_only_girl 只适合女:yes=是,no=否
|
*/
|
||||||
* type 选项类型:one=单选,more=多选
|
function updateHdrquestionnairequestion(){
|
||||||
* api/Hdrquestionnairequestion/updateHdrquestionnairequestion
|
Tools::log_to_write_txt(['修改科室问卷问题(一个问题对应多个答案)'=>input()]);
|
||||||
*/
|
|
||||||
function updateHdrquestionnairequestion(){
|
$api_desc = '修改科室问卷问题(一个问题对应多个答案)';
|
||||||
Tools::log_to_write_txt(['修改科室问卷问题(一个问题对应多个答案)'=>input()]);
|
Db::startTrans();
|
||||||
|
try {
|
||||||
$api_desc = '修改科室问卷问题(一个问题对应多个答案)';
|
|
||||||
Db::startTrans();
|
$hdrdepartment_id = input('hdrdepartment_id');
|
||||||
try {
|
$question = input('question');
|
||||||
|
$is_common = input('is_common');
|
||||||
$hdrdepartment_id = input('hdrdepartment_id');
|
$is_only_boy = input('is_only_boy');
|
||||||
$question = input('question');
|
$is_only_girl = input('is_only_girl');
|
||||||
$is_common = input('is_common');
|
$type = input('type');
|
||||||
$is_only_boy = input('is_only_boy');
|
if(empty(input('id'))){
|
||||||
$is_only_girl = input('is_only_girl');
|
return json(Tools::set_fail('参数错误。0'));
|
||||||
$type = input('type');
|
}
|
||||||
if(empty(input('id'))){
|
|
||||||
return json(Tools::set_fail('参数错误。0'));
|
|
||||||
}
|
$data = [
|
||||||
|
'hdrdepartment_id'=>$hdrdepartment_id?:'',
|
||||||
|
'question'=>$question?:'',
|
||||||
$data = [
|
'is_common'=>$is_common?:'',
|
||||||
'hdrdepartment_id'=>$hdrdepartment_id?:'',
|
'is_only_boy'=>$is_only_boy?:'',
|
||||||
'question'=>$question?:'',
|
'is_only_girl'=>$is_only_girl?:'',
|
||||||
'is_common'=>$is_common?:'',
|
'type'=>$type?:'',
|
||||||
'is_only_boy'=>$is_only_boy?:'',
|
];
|
||||||
'is_only_girl'=>$is_only_girl?:'',
|
|
||||||
'type'=>$type?:'',
|
|
||||||
];
|
$dataid = Db::table(TabConf::$fa_hdrquestionnairequestion)
|
||||||
|
->data($data)
|
||||||
|
->where('id',input('id'))
|
||||||
$dataid = Db::table(TabConf::$fa_hdrquestionnairequestion)
|
->update();
|
||||||
->data($data)
|
|
||||||
->where('id',input('id'))
|
$this->operateLog('修改科室问卷问题(一个问题对应多个答案)',api_user_info('id'));
|
||||||
->update();
|
Db::commit();
|
||||||
|
return json(Tools::set_ok('ok',$dataid));
|
||||||
$this->operateLog('修改科室问卷问题(一个问题对应多个答案)',api_user_info('id'));
|
}catch (\Exception $e){
|
||||||
Db::commit();
|
Db::rollback();
|
||||||
return json(Tools::set_ok('ok',$dataid));
|
Tools::log_to_write_txt([
|
||||||
}catch (\Exception $e){
|
'error'=>'修改科室问卷问题(一个问题对应多个答案).异常.'.$e->getMessage(),
|
||||||
Db::rollback();
|
'input'=>input(),
|
||||||
Tools::log_to_write_txt([
|
'error_info'=>$e->getTraceAsString()
|
||||||
'error'=>'修改科室问卷问题(一个问题对应多个答案).异常.'.$e->getMessage(),
|
]);
|
||||||
'input'=>input(),
|
return json(Tools::set_fail());
|
||||||
'error_info'=>$e->getTraceAsString()
|
}
|
||||||
]);
|
}
|
||||||
return json(Tools::set_fail());
|
|
||||||
|
/**
|
||||||
|
* desc: 删除科室问卷问题(一个问题对应多个答案)
|
||||||
|
* author:wh
|
||||||
|
*
|
||||||
|
* 参数:
|
||||||
|
* id 数据id 必须
|
||||||
|
*
|
||||||
|
* api/Hdrquestionnairequestion/del
|
||||||
|
*/
|
||||||
|
function del(){
|
||||||
|
Tools::log_to_write_txt(['删除科室问卷问题(一个问题对应多个答案)'=>input()]);
|
||||||
|
|
||||||
|
$api_desc = '删除科室问卷问题(一个问题对应多个答案)';
|
||||||
|
try {
|
||||||
|
|
||||||
|
$id = input('id');
|
||||||
|
if(empty($id)){
|
||||||
|
return json(Tools::set_fail('参数错误。0'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Db::table(TabConf::$fa_hdrquestionnairequestion)
|
||||||
|
->where('id',$id)
|
||||||
|
->delete();
|
||||||
|
|
||||||
|
|
||||||
|
return json(Tools::set_ok('ok'));
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Tools::log_to_write_txt([
|
||||||
|
'error'=>'删除科室问卷问题(一个问题对应多个答案).异常.'.$e->getMessage(),
|
||||||
|
'input'=>input(),
|
||||||
|
'error_info'=>$e->getTraceAsString()
|
||||||
|
]);
|
||||||
|
return json(Tools::set_fail());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user