96 lines
2.8 KiB
PHP
96 lines
2.8 KiB
PHP
<?php
|
|
|
|
namespace service\modules\v1\controllers;
|
|
|
|
use common\core\BaseServiceController;
|
|
use common\models\oldDb\UserPatientCase;
|
|
use service\models\forms\CaseForm;
|
|
use yii\base\Exception;
|
|
|
|
/**
|
|
* @doc-module 病历
|
|
*/
|
|
class CaseController extends BaseServiceController
|
|
{
|
|
/**
|
|
* @doc-name 提交病历
|
|
* @doc-param int user_patient_id 就诊人id
|
|
* @doc-param int register_id 挂号id
|
|
* @doc-param int height 身高 / optional
|
|
* @doc-param int weight 体重 / optional
|
|
* @doc-param int temperature 体重 / optional
|
|
* @doc-param int blood 血压 / optional
|
|
* @doc-param string main_suit 主诉 / optional
|
|
* @doc-param string family 家族史 / optional
|
|
* @doc-param string now_history 现病史 / optional
|
|
* @doc-param string popular 流行病史 / optional
|
|
* @doc-param string history 既往史 / optional
|
|
* @doc-param string allergic 过敏史 / optional
|
|
* @doc-param string idea 意见 / optional
|
|
*/
|
|
public function actionSaveCase()
|
|
{
|
|
$post=\Yii::$app->request->post();
|
|
$CaseForm=new CaseForm();
|
|
$CaseForm->attributes=$post;
|
|
|
|
return $CaseForm->save();
|
|
}
|
|
|
|
/**
|
|
* 修改病历
|
|
*/
|
|
public function actionEditCase()
|
|
{
|
|
$post=\Yii::$app->request->post();
|
|
$CaseForm=new CaseForm();
|
|
$CaseForm->attributes=$post;
|
|
|
|
return $CaseForm->update();
|
|
}
|
|
|
|
/**
|
|
* @doc-name 查看病历
|
|
* @doc-param int user_patient_id 患者id
|
|
* @doc-param int register_id 挂号id
|
|
* @doc-return mixed @UserPatientCase{*,@UserPatient{*}} 病历
|
|
*/
|
|
public function actionCaseInfo()
|
|
{
|
|
$post=\Yii::$app->request->post();
|
|
$CaseForm=new CaseForm();
|
|
$CaseForm->attributes=$post;
|
|
|
|
return $CaseForm->info();
|
|
}
|
|
|
|
/**
|
|
* @doc-name 病历列表
|
|
* @doc-param string main_suit 主诉 / optional
|
|
* @doc-return mixed @UserPatientCase{*} 病历
|
|
* @doc-return mixed @Pagination{total-int-总数据,totalPage-int-总页数,pageSize-int-每页数据} 分页信息
|
|
*/
|
|
public function actionCaseList()
|
|
{
|
|
$post=\Yii::$app->request->post();
|
|
$UserPatientCase = UserPatientCase::find()->where([
|
|
'service_user_id' => \Yii::$app->user->id,
|
|
'store_id' => \Yii::$app->store,
|
|
'is_delete' => 0,
|
|
])->with(['userPatient'])->asArray()->all();
|
|
|
|
if (!$UserPatientCase) throw new Exception('暂无病历');
|
|
|
|
$query= UserPatientCase::find()->where([
|
|
'service_user_id' => \Yii::$app->user->id,
|
|
'store_id' => \Yii::$app->store,
|
|
'is_delete' => 0,
|
|
])->with(['userPatient'])->orderBy(['id'=>SORT_DESC]);
|
|
|
|
if (!empty($post['main_suit'])){
|
|
$query->andWhere(['main_suit'=>$post['main_suit']]);
|
|
}
|
|
return $this->create($query,$post);
|
|
}
|
|
|
|
} |