From cd9726809875442679f72e705ceb99b8bd17ce53 Mon Sep 17 00:00:00 2001 From: wh <382379437@qq.com> Date: Wed, 7 Aug 2024 23:09:24 +0800 Subject: [PATCH] fixed --- .../api/controller/Hdrdoctorusers.php | 251 ++++++++++++++++++ .../controller/Hdrquestionnairequestion.php | 134 ++++++++++ digital_doctor/public/api_docs/api_list.html | 185 +++++++++++++ digital_doctor/public/api_docs/api_list.md | 110 ++++++++ 4 files changed, 680 insertions(+) create mode 100644 digital_doctor/application/api/controller/Hdrdoctorusers.php diff --git a/digital_doctor/application/api/controller/Hdrdoctorusers.php b/digital_doctor/application/api/controller/Hdrdoctorusers.php new file mode 100644 index 0000000..bdef190 --- /dev/null +++ b/digital_doctor/application/api/controller/Hdrdoctorusers.php @@ -0,0 +1,251 @@ +input()]); + $api_desc = '新增医生账户信息'; + Db::startTrans(); + try { + + $doctor = input('doctor'); + if(empty($doctor)){ + return json(Tools::set_fail('参数错误.0')); + } + + $username = input('username'); + if(empty($username)){ + return json(Tools::set_fail('参数错误.1')); + } + + $hdrdepartment_id = input('hdrdepartment_id'); + if(empty($hdrdepartment_id)){ + return json(Tools::set_fail('参数错误.2')); + } + + $name = input('name'); + if(empty($name)){ + return json(Tools::set_fail('参数错误.3')); + } + + $password = input('password'); + if(empty($password)){ + return json(Tools::set_fail('参数错误.4')); + } + + + $data = [ + 'doctor'=>$doctor?:'', + 'username'=>$username?:'', + 'hdrdepartment_id'=>$hdrdepartment_id?:'', + 'name'=>$name?:'', + 'password'=>$password?:'', + ]; + + + $dataid = Db::table(TabConf::$fa_hdrdoctorusers)->insertGetId($data); + + $this->operateLog('新增医生账户信息',api_user_info('id')); + Db::commit(); + return json(Tools::set_ok('ok',$dataid)); + }catch (\Exception $e){ + Db::rollback(); + Tools::log_to_write_txt([ + 'error'=>'新增医生账户信息.异常.'.$e->getMessage(), + 'input'=>input(), + 'error_info'=>$e->getTraceAsString() + ]); + return json(Tools::set_fail()); + } + } + + + /** + * 修改医生账户信息 + * 参数: + * id ID ID 必须 + * doctor 医生昵称(杨教授) + * username 用户名(手机号) + * hdrdepartment_id 科室 + * name 姓名(杨玉环) + * password 密码a123456 + * sex 性别 + * age 年龄 + * address 住址 + * api/Hdrdoctorusers/updateHdrdoctorusers + */ + function updateHdrdoctorusers(){ + Tools::log_to_write_txt(['修改医生账户信息'=>input()]); + + $api_desc = '修改医生账户信息'; + Db::startTrans(); + try { + + $doctor = input('doctor'); + $username = input('username'); + $hdrdepartment_id = input('hdrdepartment_id'); + $name = input('name'); + $password = input('password'); + $sex = input('sex'); + $age = input('age'); + $address = input('address'); + if(empty(input('id'))){ + return json(Tools::set_fail('参数错误。0')); + } + + + $data = [ + 'doctor'=>$doctor?:'', + 'username'=>$username?:'', + 'hdrdepartment_id'=>$hdrdepartment_id?:'', + 'name'=>$name?:'', + 'password'=>$password?:'', + 'sex'=>$sex?:'', + 'age'=>$age?:'', + 'address'=>$address?:'', + ]; + + + $dataid = Db::table(TabConf::$fa_hdrdoctorusers) + ->data($data) + ->where('id',input('id')) + ->update(); + + $this->operateLog('修改医生账户信息',api_user_info('id')); + Db::commit(); + return json(Tools::set_ok('ok',$dataid)); + }catch (\Exception $e){ + Db::rollback(); + Tools::log_to_write_txt([ + 'error'=>'修改医生账户信息.异常.'.$e->getMessage(), + 'input'=>input(), + 'error_info'=>$e->getTraceAsString() + ]); + return json(Tools::set_fail()); + } + } + /** + * desc:获取医生账户信息 + * + * api/Hdrdoctorusers/getHdrdoctorusersList + * + * 参数: + * 带分页 + * current_page 当前页码 + * list_rows 每页显示条数 默认15 + * doctor 医生昵称(杨教授) + * username 用户名(手机号) + * name 姓名(杨玉环) + * id ID + * doctor 医生昵称(杨教授) + * username 用户名(手机号) + * hdrdepartment_id 科室 + * name 姓名(杨玉环) + * + * 所有字段说明(可能有部分额外字段未在此体现): + * id ID + * doctor 医生昵称(杨教授) + * username 用户名(手机号) + * hdrdepartment_id 科室 + * name 姓名(杨玉环) + * password 密码a123456 + * sex 性别 + * age 年龄 + * type 用户类型:user=用户,doc=医生 + * address 住址 + * clientid 客户端ID + * expires 有效期 + * ticket 票据 + * create_time 创建时间 + + * author:wh + */ + function getHdrdoctorusersList(){ + Tools::log_to_write_txt(['获取医生账户信息 入参:'=>input()]); + $api_desc = '获取医生账户信息'; + try { + + $id = input('id'); + $doctor = input('doctor'); + $username = input('username'); + $hdrdepartment_id = input('hdrdepartment_id'); + $name = input('name'); + + + $model_obj = Db::table(TabConf::$fa_hdrdoctorusers); + + if(input('doctor')){ + $model_obj->whereLike('doctor','%'.input('doctor').'%'); + } + + if(input('username')){ + $model_obj->whereLike('username','%'.input('username').'%'); + } + + if(input('name')){ + $model_obj->whereLike('name','%'.input('name').'%'); + } + + if(input('id')){ + $model_obj->where('id',input('id')); + } + if(input('doctor')){ + $model_obj->where('doctor',input('doctor')); + } + if(input('username')){ + $model_obj->where('username',input('username')); + } + if(input('hdrdepartment_id')){ + $model_obj->where('hdrdepartment_id',input('hdrdepartment_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,'操作异常',[])); + } + } +} \ No newline at end of file diff --git a/digital_doctor/application/api/controller/Hdrquestionnairequestion.php b/digital_doctor/application/api/controller/Hdrquestionnairequestion.php index 71678b2..e42d9b7 100644 --- a/digital_doctor/application/api/controller/Hdrquestionnairequestion.php +++ b/digital_doctor/application/api/controller/Hdrquestionnairequestion.php @@ -114,5 +114,139 @@ class Hdrquestionnairequestion extends BaseHttpApi ]); return json(Tools::set_res(500,'操作异常',[])); } + } + /** + * 新增科室问卷问题(一个问题对应多个答案) + * + * 参数: + * hdrdepartment_id 所属科室 所属科室 必须 + * question 问卷问题 问卷问题 必须 + * is_common 是否通用:yes=是,no=否 是否通用:yes=是,no=否 必须 + * is_only_boy 只适合男:yes=是,no=否 只适合男:yes=是,no=否 必须 + * is_only_girl 只适合女:yes=是,no=否 只适合女:yes=是,no=否 必须 + * type 选项类型:one=单选,more=多选 选项类型:one=单选,more=多选 必须 + * api/Hdrquestionnairequestion/addHdrquestionnairequestion + */ + function addHdrquestionnairequestion(){ + Tools::log_to_write_txt(['新增科室问卷问题(一个问题对应多个答案)'=>input()]); + $api_desc = '新增科室问卷问题(一个问题对应多个答案)'; + Db::startTrans(); + try { + + $hdrdepartment_id = input('hdrdepartment_id'); + if(empty($hdrdepartment_id)){ + return json(Tools::set_fail('参数错误.0')); + } + + $question = input('question'); + if(empty($question)){ + return json(Tools::set_fail('参数错误.1')); + } + + $is_common = input('is_common'); + if(empty($is_common)){ + return json(Tools::set_fail('参数错误.2')); + } + + $is_only_boy = input('is_only_boy'); + if(empty($is_only_boy)){ + return json(Tools::set_fail('参数错误.3')); + } + + $is_only_girl = input('is_only_girl'); + if(empty($is_only_girl)){ + return json(Tools::set_fail('参数错误.4')); + } + + $type = input('type'); + if(empty($type)){ + return json(Tools::set_fail('参数错误.5')); + } + + + $data = [ + 'hdrdepartment_id'=>$hdrdepartment_id?:'', + 'question'=>$question?:'', + 'is_common'=>$is_common?:'', + 'is_only_boy'=>$is_only_boy?:'', + 'is_only_girl'=>$is_only_girl?:'', + 'type'=>$type?:'', + ]; + + + $dataid = Db::table(TabConf::$fa_hdrquestionnairequestion)->insertGetId($data); + + $this->operateLog('新增科室问卷问题(一个问题对应多个答案)',api_user_info('id')); + Db::commit(); + return json(Tools::set_ok('ok',$dataid)); + }catch (\Exception $e){ + Db::rollback(); + Tools::log_to_write_txt([ + 'error'=>'新增科室问卷问题(一个问题对应多个答案).异常.'.$e->getMessage(), + 'input'=>input(), + 'error_info'=>$e->getTraceAsString() + ]); + return json(Tools::set_fail()); + } } + + /** + * 修改科室问卷问题(一个问题对应多个答案) + * 参数: + * id ID ID 必须 + * hdrdepartment_id 所属科室 + * question 问卷问题 + * is_common 是否通用:yes=是,no=否 + * is_only_boy 只适合男:yes=是,no=否 + * is_only_girl 只适合女:yes=是,no=否 + * type 选项类型:one=单选,more=多选 + * api/Hdrquestionnairequestion/updateHdrquestionnairequestion + */ + function updateHdrquestionnairequestion(){ + Tools::log_to_write_txt(['修改科室问卷问题(一个问题对应多个答案)'=>input()]); + + $api_desc = '修改科室问卷问题(一个问题对应多个答案)'; + Db::startTrans(); + try { + + $hdrdepartment_id = input('hdrdepartment_id'); + $question = input('question'); + $is_common = input('is_common'); + $is_only_boy = input('is_only_boy'); + $is_only_girl = input('is_only_girl'); + $type = input('type'); + if(empty(input('id'))){ + return json(Tools::set_fail('参数错误。0')); + } + + + $data = [ + 'hdrdepartment_id'=>$hdrdepartment_id?:'', + 'question'=>$question?:'', + 'is_common'=>$is_common?:'', + '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')) + ->update(); + + $this->operateLog('修改科室问卷问题(一个问题对应多个答案)',api_user_info('id')); + Db::commit(); + return json(Tools::set_ok('ok',$dataid)); + }catch (\Exception $e){ + Db::rollback(); + Tools::log_to_write_txt([ + 'error'=>'修改科室问卷问题(一个问题对应多个答案).异常.'.$e->getMessage(), + 'input'=>input(), + 'error_info'=>$e->getTraceAsString() + ]); + return json(Tools::set_fail()); + } + } + } \ No newline at end of file diff --git a/digital_doctor/public/api_docs/api_list.html b/digital_doctor/public/api_docs/api_list.html index 7e44842..d86f93d 100644 --- a/digital_doctor/public/api_docs/api_list.html +++ b/digital_doctor/public/api_docs/api_list.html @@ -53,6 +53,109 @@
+
+
+*** +``` + /** + * 新增医生账户信息 + * + * 参数: + * doctor 医生昵称(杨教授) 医生昵称(杨教授) 必须 + * username 用户名(手机号) 用户名(手机号) 必须 + * hdrdepartment_id 科室 科室 必须 + * name 姓名(杨玉环) 姓名(杨玉环) 必须 + * password 密码a123456 密码a123456 必须 + * api/Hdrdoctorusers/addHdrdoctorusers + * api/hdrdoctorusers/addHdrdoctorusers + */ +``` +
+
+ 按需填写其它接口参数: + + 测试 +
+
+ +
+
+*** +``` + /** + * 修改医生账户信息 + * 参数: + * id ID ID 必须 + * doctor 医生昵称(杨教授) + * username 用户名(手机号) + * hdrdepartment_id 科室 + * name 姓名(杨玉环) + * password 密码a123456 + * sex 性别 + * age 年龄 + * address 住址 + * api/Hdrdoctorusers/updateHdrdoctorusers + * api/hdrdoctorusers/updateHdrdoctorusers + */ +``` +
+
+ 按需填写其它接口参数: + + 测试 +
+
+ +
+
+*** +``` + /** + * desc:获取医生账户信息 + * + * api/Hdrdoctorusers/getHdrdoctorusersList + * + * 参数: + * 带分页 + * current_page 当前页码 + * list_rows 每页显示条数 默认15 + * doctor 医生昵称(杨教授) + * username 用户名(手机号) + * name 姓名(杨玉环) + * id ID + * doctor 医生昵称(杨教授) + * username 用户名(手机号) + * hdrdepartment_id 科室 + * name 姓名(杨玉环) + * + * 所有字段说明(可能有部分额外字段未在此体现): + * id ID + * doctor 医生昵称(杨教授) + * username 用户名(手机号) + * hdrdepartment_id 科室 + * name 姓名(杨玉环) + * password 密码a123456 + * sex 性别 + * age 年龄 + * type 用户类型:user=用户,doc=医生 + * address 住址 + * clientid 客户端ID + * expires 有效期 + * ticket 票据 + * create_time 创建时间 + + * author:wh + * api/hdrdoctorusers/getHdrdoctorusersList + */ +``` +
+
+ 按需填写其它接口参数: + + 测试 +
+
+
*** @@ -224,6 +327,58 @@
+
+
+*** +``` + /** + * 新增科室问卷问题(一个问题对应多个答案) + * + * 参数: + * hdrdepartment_id 所属科室 所属科室 必须 + * question 问卷问题 问卷问题 必须 + * is_common 是否通用:yes=是,no=否 是否通用:yes=是,no=否 必须 + * is_only_boy 只适合男:yes=是,no=否 只适合男:yes=是,no=否 必须 + * is_only_girl 只适合女:yes=是,no=否 只适合女:yes=是,no=否 必须 + * type 选项类型:one=单选,more=多选 选项类型:one=单选,more=多选 必须 + * api/Hdrquestionnairequestion/addHdrquestionnairequestion + * api/hdrquestionnairequestion/addHdrquestionnairequestion + */ +``` +
+
+ 按需填写其它接口参数: + + 测试 +
+
+ +
+
+*** +``` + /** + * 修改科室问卷问题(一个问题对应多个答案) + * 参数: + * id ID ID 必须 + * hdrdepartment_id 所属科室 + * question 问卷问题 + * is_common 是否通用:yes=是,no=否 + * is_only_boy 只适合男:yes=是,no=否 + * is_only_girl 只适合女:yes=是,no=否 + * type 选项类型:one=单选,more=多选 + * api/Hdrquestionnairequestion/updateHdrquestionnairequestion + * api/hdrquestionnairequestion/updateHdrquestionnairequestion + */ +``` +
+
+ 按需填写其它接口参数: + + 测试 +
+
+
*** @@ -1071,6 +1226,24 @@ $('.api_hdrdepartment_getHdrdepartmentList_response_result').html(JSON.stringify(res, null, "\t")); $('.api_hdrdepartment_getHdrdepartmentList_response_result').attr('style','color:green'); },'json'); + }, api_hdrdoctorusers_addHdrdoctorusers(){ + let url = $('#api_hdrdoctorusers_addHdrdoctorusers_textarea').val(); + $.post(url,{},function(res) { + $('.api_hdrdoctorusers_addHdrdoctorusers_response_result').html(JSON.stringify(res, null, "\t")); + $('.api_hdrdoctorusers_addHdrdoctorusers_response_result').attr('style','color:green'); + },'json'); + }, api_hdrdoctorusers_updateHdrdoctorusers(){ + let url = $('#api_hdrdoctorusers_updateHdrdoctorusers_textarea').val(); + $.post(url,{},function(res) { + $('.api_hdrdoctorusers_updateHdrdoctorusers_response_result').html(JSON.stringify(res, null, "\t")); + $('.api_hdrdoctorusers_updateHdrdoctorusers_response_result').attr('style','color:green'); + },'json'); + }, api_hdrdoctorusers_getHdrdoctorusersList(){ + let url = $('#api_hdrdoctorusers_getHdrdoctorusersList_textarea').val(); + $.post(url,{},function(res) { + $('.api_hdrdoctorusers_getHdrdoctorusersList_response_result').html(JSON.stringify(res, null, "\t")); + $('.api_hdrdoctorusers_getHdrdoctorusersList_response_result').attr('style','color:green'); + },'json'); }, api_hdrfollowup_addHdrfollowup(){ let url = $('#api_hdrfollowup_addHdrfollowup_textarea').val(); $.post(url,{},function(res) { @@ -1101,6 +1274,18 @@ $('.api_hdrquestionnairequestion_getHdrquestionnairequestionList_response_result').html(JSON.stringify(res, null, "\t")); $('.api_hdrquestionnairequestion_getHdrquestionnairequestionList_response_result').attr('style','color:green'); },'json'); + }, api_hdrquestionnairequestion_addHdrquestionnairequestion(){ + let url = $('#api_hdrquestionnairequestion_addHdrquestionnairequestion_textarea').val(); + $.post(url,{},function(res) { + $('.api_hdrquestionnairequestion_addHdrquestionnairequestion_response_result').html(JSON.stringify(res, null, "\t")); + $('.api_hdrquestionnairequestion_addHdrquestionnairequestion_response_result').attr('style','color:green'); + },'json'); + }, api_hdrquestionnairequestion_updateHdrquestionnairequestion(){ + let url = $('#api_hdrquestionnairequestion_updateHdrquestionnairequestion_textarea').val(); + $.post(url,{},function(res) { + $('.api_hdrquestionnairequestion_updateHdrquestionnairequestion_response_result').html(JSON.stringify(res, null, "\t")); + $('.api_hdrquestionnairequestion_updateHdrquestionnairequestion_response_result').attr('style','color:green'); + },'json'); }, api_hdrregister_addHdrregister(){ let url = $('#api_hdrregister_addHdrregister_textarea').val(); $.post(url,{},function(res) { diff --git a/digital_doctor/public/api_docs/api_list.md b/digital_doctor/public/api_docs/api_list.md index 44d6978..4eb26d9 100644 --- a/digital_doctor/public/api_docs/api_list.md +++ b/digital_doctor/public/api_docs/api_list.md @@ -33,6 +33,82 @@ */ ``` +*** +``` + /** + * 新增医生账户信息 + * + * 参数: + * doctor 医生昵称(杨教授) 医生昵称(杨教授) 必须 + * username 用户名(手机号) 用户名(手机号) 必须 + * hdrdepartment_id 科室 科室 必须 + * name 姓名(杨玉环) 姓名(杨玉环) 必须 + * password 密码a123456 密码a123456 必须 + * api/Hdrdoctorusers/addHdrdoctorusers + * api/hdrdoctorusers/addHdrdoctorusers + */ +``` + +*** +``` + /** + * 修改医生账户信息 + * 参数: + * id ID ID 必须 + * doctor 医生昵称(杨教授) + * username 用户名(手机号) + * hdrdepartment_id 科室 + * name 姓名(杨玉环) + * password 密码a123456 + * sex 性别 + * age 年龄 + * address 住址 + * api/Hdrdoctorusers/updateHdrdoctorusers + * api/hdrdoctorusers/updateHdrdoctorusers + */ +``` + +*** +``` + /** + * desc:获取医生账户信息 + * + * api/Hdrdoctorusers/getHdrdoctorusersList + * + * 参数: + * 带分页 + * current_page 当前页码 + * list_rows 每页显示条数 默认15 + * doctor 医生昵称(杨教授) + * username 用户名(手机号) + * name 姓名(杨玉环) + * id ID + * doctor 医生昵称(杨教授) + * username 用户名(手机号) + * hdrdepartment_id 科室 + * name 姓名(杨玉环) + * + * 所有字段说明(可能有部分额外字段未在此体现): + * id ID + * doctor 医生昵称(杨教授) + * username 用户名(手机号) + * hdrdepartment_id 科室 + * name 姓名(杨玉环) + * password 密码a123456 + * sex 性别 + * age 年龄 + * type 用户类型:user=用户,doc=医生 + * address 住址 + * clientid 客户端ID + * expires 有效期 + * ticket 票据 + * create_time 创建时间 + + * author:wh + * api/hdrdoctorusers/getHdrdoctorusersList + */ +``` + *** ``` /** @@ -159,6 +235,40 @@ */ ``` +*** +``` + /** + * 新增科室问卷问题(一个问题对应多个答案) + * + * 参数: + * hdrdepartment_id 所属科室 所属科室 必须 + * question 问卷问题 问卷问题 必须 + * is_common 是否通用:yes=是,no=否 是否通用:yes=是,no=否 必须 + * is_only_boy 只适合男:yes=是,no=否 只适合男:yes=是,no=否 必须 + * is_only_girl 只适合女:yes=是,no=否 只适合女:yes=是,no=否 必须 + * type 选项类型:one=单选,more=多选 选项类型:one=单选,more=多选 必须 + * api/Hdrquestionnairequestion/addHdrquestionnairequestion + * api/hdrquestionnairequestion/addHdrquestionnairequestion + */ +``` + +*** +``` + /** + * 修改科室问卷问题(一个问题对应多个答案) + * 参数: + * id ID ID 必须 + * hdrdepartment_id 所属科室 + * question 问卷问题 + * is_common 是否通用:yes=是,no=否 + * is_only_boy 只适合男:yes=是,no=否 + * is_only_girl 只适合女:yes=是,no=否 + * type 选项类型:one=单选,more=多选 + * api/Hdrquestionnairequestion/updateHdrquestionnairequestion + * api/hdrquestionnairequestion/updateHdrquestionnairequestion + */ +``` + *** ``` /**