初始化仓库
This commit is contained in:
86
service/modules/v1/controllers/PharmacistController.php
Normal file
86
service/modules/v1/controllers/PharmacistController.php
Normal file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
namespace service\modules\v1\controllers;
|
||||
|
||||
|
||||
use common\core\BaseServiceController;
|
||||
use common\models\DoctorInfo;
|
||||
use common\models\PharmacistIdentity;
|
||||
use common\models\PharmacistrInfo;
|
||||
use yii\db\Exception;
|
||||
|
||||
/**
|
||||
* @doc-module 药师
|
||||
*/
|
||||
class PharmacistController extends BaseServiceController
|
||||
{
|
||||
|
||||
/**
|
||||
* @doc-name 药师--个人资料接口
|
||||
* @doc-return mixed @PharmacistrInfo{avatar-string-头像,name-string-姓名,idcard-string-身份证号,mobile-string-手机号码,@Titles{name-string-职称},@Hospital{name-string-医院},@Yardes{name-string-院区},@Depart{name-string-科室},@DocPracticing{qualification-string-资格证书,practicing-string-执业证书,title-string-职称证书}} 药师个人资料
|
||||
*/
|
||||
public function actionPersonalData()
|
||||
{
|
||||
//获取用户信息
|
||||
return PharmacistrInfo::find()
|
||||
->where(['su_id' => \Yii::$app->user->identity->id])
|
||||
->with(['titles', 'depart','practings','store','identity'])
|
||||
->with(['user'=>function($u){
|
||||
$u->select(['status','reason']);
|
||||
}])
|
||||
->asArray()->one();
|
||||
}
|
||||
|
||||
/**
|
||||
* @doc-name 药师-签章信息
|
||||
* @doc-return int sign_type 签章类型1电子2手写
|
||||
* @doc-return string sign_image 签章图片
|
||||
*/
|
||||
public function actionIdentity()
|
||||
{
|
||||
return PharmacistIdentity::find()
|
||||
->select(['sign_type', 'sign_image'])
|
||||
->where([
|
||||
'su_id' => \Yii::$app->user->identity->id,
|
||||
])
|
||||
->one();
|
||||
}
|
||||
|
||||
/**
|
||||
* @doc-name 我的
|
||||
* @doc-return mixed @PharmacistrInfo{avatar-string-头像,name-string-姓名,idcard-string-身份证号,@Store{name-string-执业机构},@Titles{name-string-职称},@Yardes{name-string-院区},@Depart{name-string-科室}} 我的页面信息
|
||||
*/
|
||||
public function actionMy()
|
||||
{
|
||||
return PharmacistrInfo::find()
|
||||
->where(['su_id'=>\Yii::$app->user->identity->id])
|
||||
->select('id,su_id,avatar,idcard,name,store_id')
|
||||
->with(['store'=>function($s){
|
||||
$s->select('name');
|
||||
}])
|
||||
->with(['user'=>function($u){
|
||||
$u->select(['status','reason']);
|
||||
}])
|
||||
->asArray()->one();
|
||||
}
|
||||
|
||||
/**
|
||||
* @doc-name 编辑资料
|
||||
* @doc-param string avatar 头像 / optional
|
||||
*/
|
||||
public function actionEditInfo(){
|
||||
|
||||
$post = \Yii::$app->request->post();
|
||||
$PharmacistrInfo=PharmacistrInfo::find()->where([
|
||||
'su_id'=>\Yii::$app->user->id
|
||||
])->one();
|
||||
|
||||
if (!$PharmacistrInfo) throw new Exception('药师信息不存在');
|
||||
$PharmacistrInfo->avatar=$post['avatar'];
|
||||
|
||||
if (!$PharmacistrInfo->saveOrFail()){
|
||||
throw new Exception('编辑失败');
|
||||
}
|
||||
return ['编辑成功'];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user